Rhino Java System Exec function
Execute a system command with this small, simple command for the Rhino JavaScript engine.
function exec(cmd) {
var lines = [], line
with (JavaImporter(java.lang, java.io)) {
var proccess = Runtime.getRuntime().exec('ls -la')
var stream = new DataInputStream(proccess.getInputStream())
while (line = stream.readLine())
lines.push(line)
stream.close()
}
return lines
}Bookmark/Search this post with:
Delicious
Digg
StumbleUpon
Reddit
Facebook