Skip to content

cs8425/cordova-plugin-shell-exec

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-shell-exec

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

Supported Platforms

  • Android

Installation

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

Usage

window.ShellExec.exec(cmd, callback)

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

Example:

window.ShellExec.exec('uptime', function(res){
  console.log('exit status: ' + res.exitStatus)
  console.log('cmd output: ' + res.output)
})

JS console output:

exit status: 0
cmd output: up time: 10 days, 05:16:51, idle time: 17 days, 01:22:57, sleep time: 5 days, 16:38:37

If command execution fails (e.g. you enter wrong command), you receive exit status 100.

Notes

  • Currently plugin works properly only in user mode. Some code tweaks are needed to run commands as root (I do not have a rooted Android phone to test it).

How to Contribute

Use pull request.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 87.5%
  • JavaScript 12.5%