Re: Executing a command line, stuck.

Christian Biesinger <[email protected]> Wed, 01 Jan 2003 02:07:39 +0000
Newsgroups gmane.comp.mozilla.devel.xpcom
Message-ID <[email protected]>
Baavgai wrote:
> Perhaps the example was bad enough that the point of the question was
> missed?
> 
> I need to execute a command line.  That is, a program and a series of
> arguments.

I did understand that very well. I told you to use nsIProcess rather 
than nsILocalFile, because the latter won't help you. Here's example 
code, but keep in mind that nsIProcess is not frozen and therefore 
subject to change:

var proc = 
Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
proc.init(getLocalFile());
proc.run(false, ["argument1", "argument2", "argument3"], {});

note: I filed http://bugzilla.mozilla.org/show_bug.cgi?id=187309 to 
remove the need for the last argument, the {} part.
Keep in mind that this interface is not frozen, so it may change at any 
time.

-- 
Fiat iustitia et pereat mundus.