Process group code: // launch the task [task launch];pid_t group = setsid(); if (group == -1) { NSLog(@"setsid() == -1"); group = getpgrp(); } if (setpgid([task processIdentifier], group) == -1) {NSLog(@"unable to put task into same group as self: errno = %i", errno);}
The current process-group id is inherited across fork() and execve() - see their respective man pages. So if you reorder the operations so setsid() occurs before [task launch], then the child inherits automatically.
This doesn't mean the child can't change its own pgid/sid. And since you mention a shell, it's not unusual for shells to do exactly that.
-- GG _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
