Re: why does NSTask setpgrp on sub processes?

2010-01-20 Thread Derek Zhou
On Wednesday 20 January 2010 03:36:49 am Richard Frith-Macdonald wrote: > > On 20 Jan 2010, at 09:48, Derek Zhou wrote: > > > Oops, hit send too soon. > > > > #import > > > > int main(int argc, char** argv) > > { > > NSTask* editor = [NSTask new]; > > [editor setLaunchPath: @"vi"]; > > [edi

Re: why does NSTask setpgrp on sub processes?

2010-01-20 Thread Derek Fawcus
Actually, I believe OSX (10.4.11 anyway) calls setsid() not setpgrp(). However, setsid() also causes a new process group to be created. Using the supplied program, but running /bin/cat and then examining with 'ps ajx' I see: User PID PPID PGIDSESS JOBC STAT TT TIME COMMAND der

Re: why does NSTask setpgrp on sub processes?

2010-01-20 Thread Richard Frith-Macdonald
On 20 Jan 2010, at 09:48, Derek Zhou wrote: > Oops, hit send too soon. > > #import > > int main(int argc, char** argv) > { > NSTask* editor = [NSTask new]; > [editor setLaunchPath: @"vi"]; > [editor launch]; > [editor waitUntilExit]; > NSLog(@"finished\n"); > } > > with the setpgrp (curr

Re: why does NSTask setpgrp on sub processes?

2010-01-20 Thread David Chisnall
On 20 Jan 2010, at 09:48, Derek Zhou wrote: #import int main(int argc, char** argv) { NSTask* editor = [NSTask new]; [editor setLaunchPath: @"vi"]; [editor launch]; [editor waitUntilExit]; NSLog(@"finished\n"); } I can confirm that, on OS X, once you've fixed it to specify the full p

Re: why does NSTask setpgrp on sub processes?

2010-01-20 Thread Derek Zhou
On Wednesday 20 January 2010 01:57:10 am Richard Frith-Macdonald wrote: > I think the background process is stopped if it tries to *read*, not if it > tries to write. > I also strongly suspect that this is the behavior expected by most people ... > if background processes were freely able to read

Re: why does NSTask setpgrp on sub processes?

2010-01-20 Thread Richard Frith-Macdonald
On 20 Jan 2010, at 09:25, Derek Zhou wrote: > On Wednesday 20 January 2010 12:15:11 am Richard Frith-Macdonald wrote: >> >> On 20 Jan 2010, at 07:21, Derek Zhou wrote: >>> Here is a simple patch. It just don't setpgrp if the process is on a tty. >> >> Actually, the patch effects the task's pro

Re: why does NSTask setpgrp on sub processes?

2010-01-20 Thread Derek Zhou
On Wednesday 20 January 2010 01:25:51 am Derek Zhou wrote: > On Wednesday 20 January 2010 12:15:11 am Richard Frith-Macdonald wrote: > > > > On 20 Jan 2010, at 07:21, Derek Zhou wrote: > > > Here is a simple patch. It just don't setpgrp if the process is on a tty. > > > > Actually, the patch eff

Re: why does NSTask setpgrp on sub processes?

2010-01-20 Thread Derek Zhou
On Wednesday 20 January 2010 12:15:11 am Richard Frith-Macdonald wrote: > > On 20 Jan 2010, at 07:21, Derek Zhou wrote: > > Here is a simple patch. It just don't setpgrp if the process is on a tty. > > Actually, the patch effects the task's process group setting if the *parent* > task is on a t

Re: why does NSTask setpgrp on sub processes?

2010-01-20 Thread Richard Frith-Macdonald
On 20 Jan 2010, at 07:21, Derek Zhou wrote: > On Tuesday 19 January 2010 10:14:15 pm Derek Zhou wrote: >> On Tuesday 19 January 2010 12:59:28 am Derek Zhou wrote: >>> hi all, >>> it seems NSTask setpgrp after the fork: >>> ... >>> /*

Re: why does NSTask setpgrp on sub processes?

2010-01-19 Thread Derek Zhou
On Tuesday 19 January 2010 10:14:15 pm Derek Zhou wrote: > On Tuesday 19 January 2010 12:59:28 am Derek Zhou wrote: > > hi all, > > it seems NSTask setpgrp after the fork: > > ... > > /* > > > >* Make sure task i

Re: why does NSTask setpgrp on sub processes?

2010-01-19 Thread Richard Frith-Macdonald
On 20 Jan 2010, at 06:14, Derek Zhou wrote: > On Tuesday 19 January 2010 12:59:28 am Derek Zhou wrote: >> hi all, >> it seems NSTask setpgrp after the fork: >> ... >> /* >> >> * Make sure task is run in it's own p

Re: why does NSTask setpgrp on sub processes?

2010-01-19 Thread Derek Zhou
On Tuesday 19 January 2010 12:59:28 am Derek Zhou wrote: > hi all, > it seems NSTask setpgrp after the fork: > ... > /* > >* Make sure task is run in it's own process group. > >*/