| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <process.h> | 5 #include <process.h> |
| 6 | 6 |
| 7 #include "bin/builtin.h" | 7 #include "bin/builtin.h" |
| 8 #include "bin/globals.h" | 8 #include "bin/globals.h" |
| 9 #include "bin/process.h" | 9 #include "bin/process.h" |
| 10 #include "bin/eventhandler.h" | 10 #include "bin/eventhandler.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 static unsigned int __stdcall TerminationWaitThread(void* args) { | 204 static unsigned int __stdcall TerminationWaitThread(void* args) { |
| 205 ProcessInfo* process = reinterpret_cast<ProcessInfo*>(args); | 205 ProcessInfo* process = reinterpret_cast<ProcessInfo*>(args); |
| 206 WaitForSingleObject(process->process_handle(), INFINITE); | 206 WaitForSingleObject(process->process_handle(), INFINITE); |
| 207 int exit_code; | 207 int exit_code; |
| 208 BOOL ok = GetExitCodeProcess(process->process_handle(), | 208 BOOL ok = GetExitCodeProcess(process->process_handle(), |
| 209 reinterpret_cast<DWORD*>(&exit_code)); | 209 reinterpret_cast<DWORD*>(&exit_code)); |
| 210 if (!ok) { | 210 if (!ok) { |
| 211 fprintf(stderr, "GetExitCodeProcess failed %d\n", GetLastError()); | 211 fprintf(stderr, "GetExitCodeProcess failed %d\n", GetLastError()); |
| 212 } | 212 } |
| 213 int negative = 0; | 213 int negative = 0; |
| 214 if (exit_code == 255) { | |
| 215 exit_code = 1; | |
| 216 negative = 1; | |
| 217 } | |
| 218 if (exit_code < 0) { | 214 if (exit_code < 0) { |
| 219 exit_code = abs(exit_code); | 215 exit_code = abs(exit_code); |
| 220 negative = 1; | 216 negative = 1; |
| 221 } | 217 } |
| 222 int message[3] = { process->pid(), exit_code, negative }; | 218 int message[3] = { process->pid(), exit_code, negative }; |
| 223 DWORD written; | 219 DWORD written; |
| 224 ok = WriteFile( | 220 ok = WriteFile( |
| 225 process->exit_pipe(), message, sizeof(message), &written, NULL); | 221 process->exit_pipe(), message, sizeof(message), &written, NULL); |
| 226 if (!ok || written != sizeof(message)) { | 222 if (!ok || written != sizeof(message)) { |
| 227 fprintf(stderr, "WriteFile failed %d\n", GetLastError()); | 223 fprintf(stderr, "WriteFile failed %d\n", GetLastError()); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 return false; | 404 return false; |
| 409 } | 405 } |
| 410 } | 406 } |
| 411 return true; | 407 return true; |
| 412 } | 408 } |
| 413 | 409 |
| 414 | 410 |
| 415 void Process::Exit(intptr_t id) { | 411 void Process::Exit(intptr_t id) { |
| 416 RemoveProcess(id); | 412 RemoveProcess(id); |
| 417 } | 413 } |
| OLD | NEW |