| 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 "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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 if (WIFSIGNALED(status)) { | 100 if (WIFSIGNALED(status)) { |
| 101 exit_code = WTERMSIG(status); | 101 exit_code = WTERMSIG(status); |
| 102 negative = 1; | 102 negative = 1; |
| 103 } | 103 } |
| 104 ProcessInfo* process = LookupProcess(pid); | 104 ProcessInfo* process = LookupProcess(pid); |
| 105 if (process != NULL) { | 105 if (process != NULL) { |
| 106 int message[3] = { pid, exit_code, negative }; | 106 int message[3] = { pid, exit_code, negative }; |
| 107 intptr_t result = | 107 intptr_t result = |
| 108 FDUtils::WriteToBlocking(process->fd(), &message, sizeof(message)); | 108 FDUtils::WriteToBlocking(process->fd(), &message, sizeof(message)); |
| 109 if (result != sizeof(message)) { | 109 if (result != sizeof(message) && errno != EPIPE) { |
| 110 perror("ExitHandler notification failed"); | 110 perror("ExitHandler notification failed"); |
| 111 } | 111 } |
| 112 close(process->fd()); | 112 close(process->fd()); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 | 117 |
| 118 int Process::Start(const char* path, | 118 int Process::Start(const char* path, |
| 119 char* arguments[], | 119 char* arguments[], |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 if (result == -1) { | 338 if (result == -1) { |
| 339 return false; | 339 return false; |
| 340 } | 340 } |
| 341 return true; | 341 return true; |
| 342 } | 342 } |
| 343 | 343 |
| 344 | 344 |
| 345 void Process::Exit(intptr_t id) { | 345 void Process::Exit(intptr_t id) { |
| 346 RemoveProcess(id); | 346 RemoveProcess(id); |
| 347 } | 347 } |
| OLD | NEW |