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

Side by Side Diff: runtime/bin/process_impl.dart

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, 2 months 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.dart ('k') | runtime/bin/process_linux.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 _exit(int status) native "Exit"; 5 _exit(int status) native "Exit";
6 6
7 class _ProcessStartStatus { 7 class _ProcessStartStatus {
8 int _errorCode; // Set to OS error code if process start failed. 8 int _errorCode; // Set to OS error code if process start failed.
9 String _errorMessage; // Set to OS error message if process start failed. 9 String _errorMessage; // Set to OS error message if process start failed.
10 } 10 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return _err.inputStream; 221 return _err.inputStream;
222 } 222 }
223 223
224 OutputStream get stdin { 224 OutputStream get stdin {
225 if (_closed) { 225 if (_closed) {
226 throw new ProcessException("Process closed"); 226 throw new ProcessException("Process closed");
227 } 227 }
228 return _out.outputStream; 228 return _out.outputStream;
229 } 229 }
230 230
231 void kill([ProcessSignal signal = ProcessSignal.SIGTERM]) { 231 bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]) {
232 if (signal is! ProcessSignal) { 232 if (signal is! ProcessSignal) {
233 throw new ArgumentError( 233 throw new ArgumentError(
234 "Argument 'signal' must be a ProcessSignal"); 234 "Argument 'signal' must be a ProcessSignal");
235 } 235 }
236 assert(_started); 236 assert(_started);
237 if (_ended) return; 237 if (_ended) return false;
238 if (_kill(this, signal._signalNumber)) return; 238 return _kill(this, signal._signalNumber);
239 throw new ProcessException("Could not kill process");
240 } 239 }
241 240
242 bool _kill(Process p, int signal) native "Process_Kill"; 241 bool _kill(Process p, int signal) native "Process_Kill";
243 242
244 void close() { 243 void close() {
245 if (_closed) { 244 if (_closed) {
246 throw new ProcessException("Process closed"); 245 throw new ProcessException("Process closed");
247 } 246 }
248 _in.close(); 247 _in.close();
249 _out.close(); 248 _out.close();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 371
373 class _ProcessResult implements ProcessResult { 372 class _ProcessResult implements ProcessResult {
374 const _ProcessResult(int this.exitCode, 373 const _ProcessResult(int this.exitCode,
375 String this.stdout, 374 String this.stdout,
376 String this.stderr); 375 String this.stderr);
377 376
378 final int exitCode; 377 final int exitCode;
379 final String stdout; 378 final String stdout;
380 final String stderr; 379 final String stderr;
381 } 380 }
OLDNEW
« no previous file with comments | « runtime/bin/process.dart ('k') | runtime/bin/process_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698