Skip to content

Poyser1911/cordova-plugin-shell-exec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-shell-exec

Apache Cordova Plugin to Execute Root Commands Android in Smartphone's Operating System Shell.

This is a MODIFIED version of https://github.com/petervojtek/cordova-plugin-shell-exec to be complatible with all commands formats without using arrays.
See Useage and Examples
Note: All Commands Excutes in Root Mode at the moment, this can be modified later.

Supported Platforms

  • Android

Installation

$ cordova plugin add https://github.com/Poyser1911/cordova-plugin-shell-exec.git

Usage

window.ShellExec.exec(cmd, callback);

cmd : String.

callback : function will return a object with two keys - exitStatus and output.

Examples: "Quotes Around Path are optional"

var cmd = 'ls';
cmd = 'ls /data';
cmd = 'ls "/data/system\ prefs""; //escaped Whitespace

cmd = 'ls && ls /data && cp "/data/data/com.example.app" "/data/data/com.example.app2" && rm -r -f  "/data/data/com.example.app2"'; //Using &&
window.ShellExec.exec(cmd, (res) =>{
  alert('exit status: ' + res.exitStatus)
  alert('cmd output: ' + res.output)
})

Alerts Result Preview

alt text

alt text

Alerts Result IFError Preview

alt text


About

A Cordova Plugin Android Device Shell Excuter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published