| // Copyright 2013 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Mostly copied from ../cmd/dist/windows.c. |
| // If there's a bug here, fix the logic there too. |
| if(strstr(q, " ") || strstr(q, "\t") || strstr(q, "\"") || strstr(q, "\\\\") || (strlen(q) > 0 && q[strlen(q)-1] == '\\')) { |
| for(j=0; j<2*nslash+1; j++) |
| for(j=0; j<2*nslash; j++) |
| memset(&si, 0, sizeof si); |
| si.dwFlags = STARTF_USESTDHANDLES; |
| si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); |
| si.hStdError = GetStdHandle(STD_ERROR_HANDLE); |
| if(!CreateProcessW(nil, r, nil, nil, TRUE, 0, nil, nil, &si, &pi)) { |
| if(WaitForMultipleObjects(1, &pi.hProcess, FALSE, INFINITE) != 0) |
| i = GetExitCodeProcess(pi.hProcess, &code); |
| CloseHandle(pi.hProcess); |
| werrstr("unsuccessful exit status: %d", (int)code); |