retval = 0;
switch (start) {
case System:
- retval = system(command.c_str());
+ case SystemDontWait:
+ retval = ::system(command.c_str());
callback();
break;
case Wait:
int index = 0;
bool more;
do {
+ childcommand = frontStrip(childcommand);
if (syscmd == 0) {
syscmd = new char[childcommand.length() + 1];
childcommand.copy(syscmd, childcommand.length());
syscmd[childcommand.length()] = '\0';
}
+ if (!childcommand.empty()) {
char * tmp = new char[childcommand.length() + 1];
childcommand.copy(tmp, childcommand.length());
tmp[childcommand.length()] = '\0';
argv[index++] = tmp;
+ }
+
// reinit
more = !rest.empty();
if (more)
cbk = cback;
pid = static_cast<pid_t>(0); // yet no child
retval = 0;
+
+ if (how == SystemDontWait) {
+#ifndef __EMX__
+ command += " &";
+#else
+ // OS/2 cmd.exe has another use for '&'
+ // This is not NLS safe, but it's OK, I think.
+ string sh = OnlyFilename(GetEnvPath("EMXSHELL"));
+ if (sh.empty()) {
+ // COMSPEC is set, unless user unsets
+ sh = OnlyFilename(GetEnvPath("COMSPEC"));
+ if (sh.empty())
+ sh = "cmd.exe";
+ }
+ sh = lowercase(sh);
+ if (contains(sh, "cmd.exe")
+ || contains(sh, "4os2.exe"))
+ command = "start /min/n " + command;
+ else
+ command += " &";
+#endif
+ }
+
return startscript();
}
int SimulateTimer;
void back(string cmd, int retval)
{
- printf("Done: %s gave %d\n", cmd.c_str(), retval);
+ ::printf("Done: %s gave %d\n", cmd.c_str(), retval);
SimulateTimer = 0;
}