Confirmed users
188
edits
(New page: This is a place to dump useful code that was removed from the Weave codebase because it was no longer required, but may still be useful elsewhere.) |
No edit summary |
||
| Line 1: | Line 1: | ||
This is a place to dump useful code that was removed from the Weave codebase because it was no longer required, but may still be useful elsewhere. | This is a place to dump useful code that was removed from the Weave codebase because it was no longer required, but may still be useful elsewhere. | ||
== runCmd == | |||
runCmd: function Weave_runCmd() { | |||
var binary; | |||
var args = []; | |||
for (let i = 0; i < arguments.length; ++i) { | |||
args.push(arguments[i]); | |||
} | |||
if (args[0] instanceof Ci.nsIFile) { | |||
binary = args.shift(); | |||
} else { | |||
binary = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); | |||
binary.initWithPath(args.shift()); | |||
} | |||
var p = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess); | |||
p.init(binary); | |||
let log = Log4Moz.Service.getLogger("Service.Util"); | |||
log.debug("Running command: " + binary.path + " " + args.join(" ")); | |||
p.run(true, args, args.length); | |||
return p.exitValue; | |||
} | |||