I’m having trouble using spawn to start a shell script. For some reason, the following error message is printed:
invalid file descriptor to bufgets: 20
The spawn function call does not return an error, so my C program thinks everything is fine. The script’s process turns into a zombie. Spawning an equivalent C program in place of the script works fine.
Here’s some sample code from the caller:
if ( (pid= spawnl( P_NOWAIT, “/home/peted/bin/sleep.sh”,
“/home/peted/bin/sleep.sh”, “0”, NULL )) == ERROR )
printf( “start_tasks: couldn’t spawn /home/peted/bin/sleep.sh 0, error= %s.”,
The script is very simple. It’s set to be world executable; the “shebang” line is in the upper left corner of the file:
while [ 1 ]
The same problem happens with a call to spawnv().