Talk:NsIProcess

Add topic
Revision as of 06:34, 10 May 2009 by Mossop (talk | contribs) (Created page with '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: <pre> int...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

Return to "NsIProcess" page.