Created
March 3, 2009 07:09
-
-
Save erickedji/73219 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function executeShellCommand (program) { | |
//use arguments.shift to implement a complete shell bridge | |
var executable = Components.classes["@mozilla.org/file/local;1"] | |
.createInstance(Components.interfaces.nsILocalFile); | |
executable.followLinks = true; | |
executable.initWithPath(program); | |
if (executable.exists()) { | |
try { | |
var process = Components.classes["@mozilla.org/process/util;1"] | |
.createInstance(Components.interfaces.nsIProcess); | |
process.init(executable); | |
var args = new Array(); | |
Application.console.log("Executable : " + executable); | |
Application.console.log("args : " + args); | |
ret = process.run(false, args, args.length); | |
Application.console.log("ret code : " + ret); | |
} catch (e) { | |
Application.console.log("Error running command : " + e); | |
displayMessage("Error running command : " + e); | |
return null; | |
} | |
} | |
} | |
function cmd_testExec() { executeShellCommand('/media/data/personnal_works/soft/bin/test'); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment