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

Side by Side Diff: runtime/bin/process_linux.cc

Issue 8989011: Undo change that converted exit code 255 to -1. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/process_macos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "bin/process.h" 5 #include "bin/process.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <signal.h> 9 #include <signal.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 87
88 void ExitHandler(int process_signal, siginfo_t* siginfo, void* tmp) { 88 void ExitHandler(int process_signal, siginfo_t* siginfo, void* tmp) {
89 int pid = 0; 89 int pid = 0;
90 int status = 0; 90 int status = 0;
91 while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { 91 while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
92 int exit_code = 0; 92 int exit_code = 0;
93 int negative = 0; 93 int negative = 0;
94 if (WIFEXITED(status)) { 94 if (WIFEXITED(status)) {
95 exit_code = WEXITSTATUS(status); 95 exit_code = WEXITSTATUS(status);
96 if (exit_code == 255) {
97 exit_code = 1;
98 negative = 1;
99 }
100 } 96 }
101 if (WIFSIGNALED(status)) { 97 if (WIFSIGNALED(status)) {
102 exit_code = WTERMSIG(status); 98 exit_code = WTERMSIG(status);
103 negative = 1; 99 negative = 1;
104 } 100 }
105 ProcessInfo* process = LookupProcess(pid); 101 ProcessInfo* process = LookupProcess(pid);
106 if (process != NULL) { 102 if (process != NULL) {
107 int message[3] = { pid, exit_code, negative }; 103 int message[3] = { pid, exit_code, negative };
108 intptr_t result = 104 intptr_t result =
109 FDUtils::WriteToBlocking(process->fd(), &message, sizeof(message)); 105 FDUtils::WriteToBlocking(process->fd(), &message, sizeof(message));
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 if (result == -1) { 346 if (result == -1) {
351 return false; 347 return false;
352 } 348 }
353 return true; 349 return true;
354 } 350 }
355 351
356 352
357 void Process::Exit(intptr_t id) { 353 void Process::Exit(intptr_t id) {
358 RemoveProcess(id); 354 RemoveProcess(id);
359 } 355 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/process_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698