Skip to content

Latest commit

 

History

History
56 lines (33 loc) · 1.41 KB

README.md

File metadata and controls

56 lines (33 loc) · 1.41 KB

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