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

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

Issue 11238057: Change Process.kill to return a boolean instead of throwing an exception when kill fails. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/process_linux.cc ('k') | runtime/bin/process_win.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 <poll.h> 9 #include <poll.h>
10 #include <signal.h> 10 #include <signal.h>
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 FDUtils::SetNonBlocking(read_err[0]); 544 FDUtils::SetNonBlocking(read_err[0]);
545 *err = read_err[0]; 545 *err = read_err[0];
546 TEMP_FAILURE_RETRY(close(read_err[1])); 546 TEMP_FAILURE_RETRY(close(read_err[1]));
547 547
548 *id = pid; 548 *id = pid;
549 return 0; 549 return 0;
550 } 550 }
551 551
552 552
553 bool Process::Kill(intptr_t id, int signal) { 553 bool Process::Kill(intptr_t id, int signal) {
554 int result = TEMP_FAILURE_RETRY(kill(id, signal)); 554 return (TEMP_FAILURE_RETRY(kill(id, signal)) != -1);
555 if (result == -1) {
556 return false;
557 }
558 return true;
559 } 555 }
560 556
561 557
562 void Process::TerminateExitCodeHandler() { 558 void Process::TerminateExitCodeHandler() {
563 ExitCodeHandler::TerminateExitCodeThread(); 559 ExitCodeHandler::TerminateExitCodeThread();
564 } 560 }
565 561
566 562
567 intptr_t Process::CurrentProcessId() { 563 intptr_t Process::CurrentProcessId() {
568 return static_cast<intptr_t>(getpid()); 564 return static_cast<intptr_t>(getpid());
569 } 565 }
OLDNEW
« 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