Arguments to exec* functions.

Neil Cerutti cerutti at together.net
Mon Nov 13 15:24:11 EST 2000


Fredrik Lundh posted:
>Neil Cerutti wrote:
>> If I'm required to put *something* there, what's a good string to
>> use? Prepending all my argument lists with "foo" seems kind of
>> stupid. Prepending all my argument lists with the executable name
>> seems kind of redundant.
>
>doesn't matter -- the exec functions are defined by the
>POSIX standard:

Oh!

>    "The argument path points to a pathname that identifies
>    the new process image file"
>
>    "The argument argv is an array of /.../ strings. /.../ These
>    strings constitute the argument list available to the new
>    process image. The value in argv[0] should point to a file-
>    name that is associated with the process being started by
>    one of the exec functions."

That's very clear. Thanks.

>here's a standard usage pattern for exec/spawn:
>
>    program = "python"
>    arguments = ["hello.py"]
>    os.execvp(program, (program,) +  tuple(arguments))

Thanks for the pattern. I searched in the *.py files for
examples of exec/spawn calls in the library but I couldn't find
any. I suppose that if I had experience with those functions in
other languages I wouldn't have been confused.

-- 
Neil Cerutti <cerutti at together.net>



More information about the Python-list mailing list