spawn syntax + os.P_WAIT mode behavior + spawn stdout redirection
peter at engcorp.com
Thu Jan 20 20:59:35 EST 2005
Derek Basch wrote:
> If the syntax of spawnl is:
> spawnl(mode, path, ...)
> Why does everyone write it like:
> os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')
> os.spawnl(os.P_WAIT, "/var/www/db/smm/smm_train", "smm_train",
> How is the first 'cp' a path to a file? why does the desired executable have to
> be named again as the first parameter?
Marginally educated guessing:
1. "cp" is a shell command, so no path is required or possible.
2. The repetition of the executable name is so that argv can
have the expected contents: the name of the executable.
More information about the Python-list