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

Unified Diff: runtime/bin/process_macos.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_linux.cc ('k') | runtime/bin/process_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_macos.cc
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc
index 79b9ce657912322bb65bd5ef5b8c756fa436de45..bd6f150a732b43a2d90d118c80e0e6966cd6d360 100644
--- a/runtime/bin/process_macos.cc
+++ b/runtime/bin/process_macos.cc
@@ -89,14 +89,21 @@ void ExitHandler(int process_signal, siginfo_t* siginfo, void* tmp) {
int status = 0;
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
int exit_code = 0;
- // TODO(ager): Transform exit_code 255 to -1.
- if (WIFEXITED(status)) exit_code = WEXITSTATUS(status);
- // TODO(ager): Transform termsig to -termsig to destinguish from
- // exit codes.
- if (WIFSIGNALED(status)) exit_code = WTERMSIG(status);
+ int negative = 0;
+ if (WIFEXITED(status)) {
+ exit_code = WEXITSTATUS(status);
+ if (exit_code == 255) {
+ exit_code = 1;
+ negative = 1;
+ }
+ }
+ if (WIFSIGNALED(status)) {
+ exit_code = WTERMSIG(status);
+ negative = 1;
+ }
ProcessInfo* process = LookupProcess(pid);
if (process != NULL) {
- intptr_t message[2] = { pid, exit_code };
+ int message[3] = { pid, exit_code, negative };
intptr_t result =
FDUtils::WriteToBlocking(process->fd(), &message, sizeof(message));
if (result != sizeof(message)) {
« no previous file with comments | « runtime/bin/process_linux.cc ('k') | runtime/bin/process_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698