if (szComSpec == NULL)
{
- szComSpec = _strdup("cmd.exe");
- if (szComSpec == NULL)
- {
- __set_errno(ENOMEM);
- return -1;
- }
+ szComSpec = "cmd.exe";
}
- s = max(strchr(szComSpec, '\\'), strchr(szComSpec, '/'));
+ /* split the path from shell command */
+ s = max(strrchr(szComSpec, '\\'), strrchr(szComSpec, '/'));
if (s == NULL)
s = szComSpec;
else
szCmdLine = malloc(strlen(s) + 4 + strlen(command) + 1);
if (szCmdLine == NULL)
{
- free (szComSpec);
__set_errno(ENOMEM);
return -1;
}
memset (&StartupInfo, 0, sizeof(StartupInfo));
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved= NULL;
- StartupInfo.dwFlags = 0;
+ StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_SHOWDEFAULT;
StartupInfo.lpReserved2 = NULL;
StartupInfo.cbReserved2 = 0;
NULL,
NULL,
TRUE,
- 0,
+ CREATE_NEW_PROCESS_GROUP,
NULL,
NULL,
&StartupInfo,
&ProcessInformation);
free(szCmdLine);
- free(szComSpec);
if (result == FALSE)
{