Index: Source/NSTask.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSTask.m,v retrieving revision 1.54 diff -u -p -r1.54 NSTask.m --- Source/NSTask.m 10 May 2002 06:39:10 -0000 1.54 +++ Source/NSTask.m 11 Feb 2003 10:45:13 -0000 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -1019,7 +1020,8 @@ static DWORD WINAPI _threadFunction(LPVO char *c_args; int result; const char *executable; - + NSString *quotedExecutable; + if (_hasLaunched) { return; @@ -1027,7 +1029,14 @@ static DWORD WINAPI _threadFunction(LPVO lpath = [self _fullLaunchPath]; executable = [lpath fileSystemRepresentation]; - args = [[NSMutableString alloc] initWithCString: executable]; + + /* If the executable name contains spaces and isn't quoted yet, quote it */ + quotedExecutable = [NSString stringWithCString: executable]; + if ([quotedExecutable rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]].length && + [quotedExecutable rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"\""]].length==0) + quotedExecutable = [NSString stringWithFormat:@"\"address@hidden"", quotedExecutable]; + + args = [[NSMutableString alloc] initWithString:quotedExecutable]; arg_enum = [[self arguments] objectEnumerator]; while ((arg = [arg_enum nextObject])) {