os.environ conflicts with my shell

Thomas Wouters thomas at xs4all.net
Wed Mar 29 16:00:48 EST 2000


On Wed, Mar 29, 2000 at 08:55:44PM +0000, Grant Edwards wrote:
> In article <20000329182414.B13073 at xs4all.nl>, Thomas Wouters wrote:

> >Oops. I stand corrected. For some reason I thought the system() library call
> >would only spawn a shell if the command to execute contained shell
> >metachars, but it doesn't. Must be a leftover from that-other-P-language ;)
> 
> Nah, can't blame it on Pxxl that's the standard C library
> semantics for system():

Actually, I _can_ (and do :) blame it on perl. From perldoc -f system:

Does exactly the same thing as "C<exec LIST>", except that a fork is done
first, and the parent process waits for the child process to complete.
Note that argument processing varies depending on the number of
arguments.  If there is more than one argument in LIST, or if LIST is
an array with more than one value, starts the program given by the
first element of the list with arguments given by the rest of the list.
If there is only one scalar argument, the argument is
checked for shell metacharacters, and if there are any, the entire
argument is passed to the system's command shell for parsing (this is
C</bin/sh -c> on Unix platforms, but varies on other platforms).  If
there are no shell metacharacters in the argument, it is split into
words and passed directly to C<execvp()>, which is more efficient.

This is why i was confused.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list