Talk:NsIProcess

From MozillaWiki
Jump to: navigation, search

I'd be inclined to hide all the nsIPOSIX*Stream and nsIPipeManager from the outside world. You could probably just do it all internally and have something simpler like:

interface nsIProcess2 : public nsISupports
{
 void init(in nsIFile program);

 nsIOutputSteam getStdin();
 nsIInputStream getStdout();
 nsIInputStream getStderr();

 readonly attribute unsigned long result;
 readonly attribute unsigned long pid;
 attribute nsIObserver listener;

 void run([array, size_is(argv)] in wstring argv, in unsigned long argc);
};

I've dropped the inherited methods since I guess those are just the default when creating it? Maybe not. I think you also want to think about the automated cases without files. Say I have some string of text that I want the process to read its stdin from, how do I do that. Say I have a socket I want the process to write its stdout to? I think you're better off having these methods instead of the file versions:

 setStdin(in nsIInputStream);
 setStdout(in nsIOutputStream);
 setStdout(in nsIOutputStream);

Any XPCOM callers can easily open up a file to use for those items if they wish, though by all means make that easy in the jsm.

I also wonder about making things match up with the way other similar components are in the tree. Maybe making use of nsIStreamListener etc.

Oh and don't call it nsIProcess2, we already have that on the 1.9.1 branch. Maybe nsIProcess3, but I think it'd just be better to find a new name.

Mossop 13:50, 11 May 2009 (UTC)