Process
From PlainOldWebserver
This is your ticket to the command line. Feedback is limited to the exit value. A non-zero exit value throws an exception.
var args = new Array();
var file = "test.pl";
var dirservice=Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties);
var f = dirservice.get('ProfD', Components.interfaces.nsILocalFile);
f = pow_append_path(f, file);
var runner = Components.classes["@mozilla.org/process/util;1"].
getService(Components.interfaces.nsIProcess);
runner.init(f);
var result = runner.run(true, args, args.length);
alert(result);
test.pl:
#! /usr/bin/perl `ls > /tmp/trash.txt`; print "OK"; exit(0);
Result:
Exit value is 0
On the Mac, the working directory is / and the output goes to the console. /tmp/trash.txt contains a directory listing.
