> 1.  Use :
> $ENV{DESTDIR} = "/mnt";
> That will set the environment variable that is passed to any
> subshells (such as system calls).  Executing a system(setenv...) is kind
> of like a noop, since the shell sets it and then exists...so it
> disappears.

This will work for script and all sub kids of the script, but not the
original shell, in which system calls get executed.

>  There really isn't a
> "good" way to deal with this.  Perhaps if the process returned it's PID
> after the fork you could look for it and then keep looking and waiting for
> it (I don't think waitpid would work for you here, since you won't get a
> signal from a process that isn't a child of yours when it exits).
>

Yeh, thats exactly what I am looking for.

----- Original Message -----
From: "Chander Ganesan" <[EMAIL PROTECTED]>
To: "Mark Goland" <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 4:37 PM
Subject: Re: waitpid


> Hello,
>
> 1.  Use :
> $ENV{DESTDIR} = "/mnt";
> That will set the environment variable that is passed to any
> subshells (such as system calls).  Executing a system(setenv...) is kind
> of like a noop, since the shell sets it and then exists...so it
> disappears.
>
> 2.  The system command will return as soon as the command it calls
> returns.  So if you run an application which forks off and detaches from
> the parent process it will return immediately.  There really isn't a
> "good" way to deal with this.  Perhaps if the process returned it's PID
> after the fork you could look for it and then keep looking and waiting for
> it (I don't think waitpid would work for you here, since you won't get a
> signal from a process that isn't a child of yours when it exits).
>
> I suspect if you fork() and then run you'll have the same issue if the
> underlying application forks off on it's own.
>
> In general, the system command is what you are looking for...for your
> special case things might be a bit more difficult.
>
> Hope that helps.
>
> Chander
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to