Mail Archives: djgpp-workers/1997/09/08/09:05:08
Hi Workers!
I have a problem with system(), when I try to run a non-existing
program. I always have SHELL=path/to/bash when working with djgpp
programs. But perl says, that I shouldn't start a shell with system()
when don't need. So I simply check for some magic character in the
command line, and if I find none, I set __sys_flags to use
__system_emulate_command. And here is my problem. When system() tries to
run a nonexistent program, its "last resort" is to pass it to the shell.
If the shell was command.com, I get 0 as the return code, and if it was
bash, I get 127. Instead of -1. Here is the patch I use:
*** system.c~ Sun Aug 31 15:40:56 1997
--- system.c Sun Sep 7 22:54:30 1997
***************
*** 245,249 ****
endcmd = 0;
}
! if (endcmd
&& (stricmp (endcmd, "exe") == 0
|| stricmp (endcmd, "com") == 0
--- 245,249 ----
endcmd = 0;
}
! if ((sys_flags & __system_emulate_command) || endcmd
&& (stricmp (endcmd, "exe") == 0
|| stricmp (endcmd, "com") == 0
- Raw text -