Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1080)

Unified Diff: runtime/bin/process_win.cc

Issue 8506013: Correct the sign of exit codes for the process library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/process_macos.cc ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_win.cc
diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc
index 36666bc8dbf5e0996780a5dfa95e3b95b0c5aa01..cfe29873afbc6ac4951c2119557037904f5c9c1f 100644
--- a/runtime/bin/process_win.cc
+++ b/runtime/bin/process_win.cc
@@ -204,16 +204,26 @@ static int SetOsErrorMessage(char* os_error_message,
static unsigned int __stdcall TerminationWaitThread(void* args) {
ProcessInfo* process = reinterpret_cast<ProcessInfo*>(args);
WaitForSingleObject(process->process_handle(), INFINITE);
- DWORD exit_code;
- BOOL ok = GetExitCodeProcess(process->process_handle(), &exit_code);
+ int exit_code;
+ BOOL ok = GetExitCodeProcess(process->process_handle(),
+ reinterpret_cast<DWORD*>(&exit_code));
if (!ok) {
fprintf(stderr, "GetExitCodeProcess failed %d\n", GetLastError());
}
- intptr_t message[2] = { process->pid(), static_cast<intptr_t>(exit_code) };
+ int negative = 0;
+ if (exit_code == 255) {
+ exit_code = 1;
+ negative = 1;
+ }
+ if (exit_code < 0) {
+ exit_code = abs(exit_code);
+ negative = 1;
+ }
+ int message[3] = { process->pid(), exit_code, negative };
DWORD written;
ok = WriteFile(
process->exit_pipe(), message, sizeof(message), &written, NULL);
- if (!ok || written != 8) {
+ if (!ok || written != sizeof(message)) {
fprintf(stderr, "FileWrite failed %d\n", GetLastError());
}
return 0;
« no previous file with comments | « runtime/bin/process_macos.cc ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698