A bad thing about ALFS in c

Matthias Benkmann matthias at winterdrache.de
Tue Nov 6 14:09:57 PST 2001


On 5 Nov 2001, at 20:41, Felipe Contreras wrote:

> On Mon, Nov 05, 2001 at 04:14:27PM -0800, John Schmerge wrote:
> > Why not just use system(3) ?
> 
> Let's supose you want to execute this.
> 
>  export LFS=/mnt/lfs
>  cd $LFS
>  ls
> 
> If you run each command in a separated system() call, then each of them
> will be executed in a subshell, so in the second system command the
> environment variable LFS will be cleared, also on the third command the
> working directory will be the same as where you started before the cd $LFS
> command. So the commands are not executed on the same shell.
> 
> If you run the commands as a whole in the same subshell then if it fails
> you can't know on which command the shell failed. Let's suppose 'cd $LFS'
> exited with an error because that directory didn't existed. So with system
> you can't really interact with the shell, just tell what to do.

What would you do with the information which command failed? Unless you 
can code the most advance AI in existence there's probably nothing you can 
do to automatically recover from such an error. I think aborting and 
passing on the error messages to the user is the best thing you can do.

MSB

----
If everything seems to be going well, you have obviously overlooked something.

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe alfs-discuss' in the subject header of the message



More information about the alfs-discuss mailing list