Article View: comp.sys.next.programmer
Article #727Re: Pipes, Child Processes and Other Uglies
From: Drew Davidson
Date: Tue, 14 Apr 1992 19:26
Date: Tue, 14 Apr 1992 19:26
67 lines
3131 bytes
3131 bytes
In article <12332@tamsun.tamu.edu> cnh5730@maraba.tamu.edu (Charles Herrick)
writes:
> In article <1992Apr8.151618.10043@fnbc.com> drew@fnbc.com (Drew
> Davidson) writes:
> $ A very good solution to this problem is contained in
> $ /NextDevelopers/Examples/Subprocess. It does exactly what you want
> and uses
> $ DPSAddFD() to tie into the stdin/stdout of the subprocess. I have
> modified
> $ this further to separate the stdout from stderr (the Subprocess
> object blends
> $ them together), allow pausing and resuming the process and some
> other neat-o's.
>
>
> Drew,
> Are you going to post to this developer group or donate them to the
> archives? (hint, hint)
>
> Chuck Herrick
I will mail it to anyone who asks. I don't really have time to package them
for the archive sites, so if some kind soul wishes to do this for me, I would
be most appreciative.
Here's a not-so-brief description:
* Added new delegate methods (SubprocessDelegate):
- subprocess:sender done:(int)exitStatus;
sent when the subprocess exits. Gives exit status of process or
code if the process was stopped/signaled.
- subprocess:sender output:(char *)buffer;
sent whenever there is data on the standard output pipe;
buffer is only valid until next call. The buffer is line-oriented.
- subprocess:sender stderrOutput:(char *)buffer;
sent whenever there is data on the standard error pipe;
buffer is only valid until next call.
- subprocess:sender error:(const char *)errorString;
sent when an error occurs;
if it ever happens, it's usually only at startup time
* New methods:
- (int)pid;
- (BOOL)isPaused;
- (BOOL)isRunning;
- pause:sender;
- resume:sender;
* Removed pty support. If you want it, it's pretty easy to put back in from
the NeXT example.
My additions were made to support a "Processes" panel like the Workspace has,
so that multiple Subprocesses could be used simultaneously and tracked
faithfully. Since this code is derived from the NeXT example code, the
disclaimer at the top of the code applies to my additions as well.
- Drew
--
+--------------------------------+------------------------------------------+
| Drew Davidson | "Whining is anger coming through a small |
| Software Guy | opening." |
| First National Bank of Chicago | - Stuart Smalley |
| drew@fnbc.com (NeXTmail) | Caring Nurturer |
+--------------------------------+------------------------------------------+
Technical Details
Message-ID:
<1992Apr14.192639.14407@fnbc.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!decwrl!infopiz!lupine!uupsi!psinntp!juliet!newsReferences:
<12332@tamsun.tamu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!decwrl!infopiz!lupine!uupsi!psinntp!juliet!news Newsgroups: comp.sys.next.programmer Subject: Re: Pipes, Child Processes and Other Uglies Message-ID: <1992Apr14.192639.14407@fnbc.com> From: drew@fnbc.com (Drew Davidson) Date: 14 Apr 92 19:26:39 GMT Reply-To: drew@fnbc.com Sender: news@fnbc.com References: <12332@tamsun.tamu.edu> Organization: First National Bank Of Chicago, Chicago IL, USA Lines: 67