.ide Host::Launch() now can handle application that has got spaces in theires names.

git-svn-id: svn://ultimatepp.org/upp/trunk@11017 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
klugier 2017-04-17 14:21:36 +00:00
parent ccf287001a
commit 02db5708ab

View file

@ -193,8 +193,18 @@ void sCleanZombies(int signal_number)
String LinuxHostConsole = "/usr/bin/xterm -e";
static char* NormalizeFirstArgument(const char* argument)
{
String str = argument;
str.Replace("\"", "");
return strdup(str);
}
void LocalHost::Launch(const char *_cmdline, bool console)
{
Cout () << "_cmdline: " << _cmdline << "\n";
String cmdline = FindCommand(exedirs, _cmdline);
PutVerbose(cmdline);
#ifdef PLATFORM_WIN32
@ -257,15 +267,20 @@ void LocalHost::Launch(const char *_cmdline, bool console)
Vector<char *> args;
const char *p = cmdline;
const char *b = p;
while(*p && (byte)*p > ' ')
if(*p++ == '\"')
while(*p && *p++ != '\"')
;
args.Add(cmd_out);
memcpy(cmd_out, b, p - b);
cmd_out += p - b;
*cmd_out++ = '\0';
cmd_out = cmd_buf;
args.Add(NormalizeFirstArgument(cmd_out));
cmd_out += p - b + 1;
while(*p)
if((byte)*p <= ' ')
p++;
@ -299,7 +314,7 @@ void LocalHost::Launch(const char *_cmdline, bool console)
sigchld_action.sa_handler = sCleanZombies;
sigaction(SIGCHLD, &sigchld_action, NULL);
}
pid_t pid = fork();
if(pid == 0)
{