Re: system command erroneously states 'can't spawn <executable>' from jimbojones
The code (from 5.8.9) win32.c that might be causing the problem
Notice that if the executable returns a negative error code, the assumption is that the spawn didn't work.int Perl_do_aspawn(pTHX_ SV *really, SV **mark, SV **sp) { char **argv; char *str; int status; int flag = P_WAIT; int index = 0; if (sp <= mark) return -1; get_shell(); Newx(argv, (sp - mark) + w32_perlshell_items + 2, char*); if (SvNIOKp(*(mark+1)) && !SvPOKp(*(mark+1))) { ++mark; flag = SvIVx(*mark); } while (++mark <= sp) { if (*mark && (str = SvPV_nolen(*mark))) argv[index++] = str; else argv[index++] = ""; } argv[index++] = 0; status = win32_spawnvp(flag, (const char*)(really ? SvPV_nolen(really) : argv[0]), (const char* const*)argv); if (status < 0 && (errno == ENOEXEC || errno == ENOENT)) { /* possible shell-builtin, invoke with shell */ int sh_items; sh_items = w32_perlshell_items; while (--index >= 0) argv[index+sh_items] = argv[index]; while (--sh_items >= 0) argv[sh_items] = w32_perlshell_vec[sh_items]; status = win32_spawnvp(flag, (const char*)(really ? SvPV_nolen(really) : argv[0] +), (const char* const*)argv); } if (flag == P_NOWAIT) { PL_statusvalue = -1; /* >16bits hint for pp_system() */ } else { if (status < 0) { if (ckWARN(WARN_EXEC)) Perl_warner(aTHX_ packWARN(WARN_EXEC), "Can't spawn \"%s\": %s +", argv[0], strerror(errno)); status = 255 * 256; } else status *= 256; PL_statusvalue = status; } Safefree(argv); return (status); }
In reply to Re: Can't spawn "cmd.exe":
by Sandy
in thread Can't spawn "cmd.exe":
by emalossi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |