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

Side by Side Diff: sdk/lib/io/process.dart

Issue 105083009: Revert "Signal handling." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « sdk/lib/_internal/lib/io_patch.dart ('k') | tests/standalone/io/signals_test.dart » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 // TODO(ager): The only reason for this class is that we 7 // TODO(ager): The only reason for this class is that we
8 // cannot patch a top-level at this point. 8 // cannot patch a top-level at this point.
9 class _ProcessUtils { 9 class _ProcessUtils {
10 external static void _exit(int status); 10 external static void _exit(int status);
11 external static void _setExitCode(int status); 11 external static void _setExitCode(int status);
12 external static void _sleep(int millis); 12 external static void _sleep(int millis);
13 external static int _pid(Process process); 13 external static int _pid(Process process);
14 external static Stream<ProcessSignal> _watchSignal(ProcessSignal signal);
15 } 14 }
16 15
17 /** 16 /**
18 * Exit the Dart VM process immediately with the given exit code. 17 * Exit the Dart VM process immediately with the given exit code.
19 * 18 *
20 * This does not wait for any asynchronous operations to terminate. Using 19 * This does not wait for any asynchronous operations to terminate. Using
21 * [exit] is therefore very likely to lose data. 20 * [exit] is therefore very likely to lose data.
22 * 21 *
23 * The handling of exit codes is platform specific. 22 * The handling of exit codes is platform specific.
24 * 23 *
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 */ 303 */
305 int get pid; 304 int get pid;
306 } 305 }
307 306
308 307
309 /** 308 /**
310 * On Posix systems, [ProcessSignal] is used to send a specific signal 309 * On Posix systems, [ProcessSignal] is used to send a specific signal
311 * to a child process, see [:Process.kill:]. 310 * to a child process, see [:Process.kill:].
312 */ 311 */
313 class ProcessSignal { 312 class ProcessSignal {
314 static const ProcessSignal SIGHUP = const ProcessSignal._(1, "SIGHUP"); 313 static const ProcessSignal SIGHUP = const ProcessSignal._signal(1);
315 static const ProcessSignal SIGINT = const ProcessSignal._(2, "SIGINT"); 314 static const ProcessSignal SIGINT = const ProcessSignal._signal(2);
316 static const ProcessSignal SIGQUIT = const ProcessSignal._(3, "SIGQUIT"); 315 static const ProcessSignal SIGQUIT = const ProcessSignal._signal(3);
317 static const ProcessSignal SIGILL = const ProcessSignal._(4, "SIGILL"); 316 static const ProcessSignal SIGILL = const ProcessSignal._signal(4);
318 static const ProcessSignal SIGTRAP = const ProcessSignal._(5, "SIGTRAP"); 317 static const ProcessSignal SIGTRAP = const ProcessSignal._signal(5);
319 static const ProcessSignal SIGABRT = const ProcessSignal._(6, "SIGABRT"); 318 static const ProcessSignal SIGABRT = const ProcessSignal._signal(6);
320 static const ProcessSignal SIGBUS = const ProcessSignal._(7, "SIGBUS"); 319 static const ProcessSignal SIGBUS = const ProcessSignal._signal(7);
321 static const ProcessSignal SIGFPE = const ProcessSignal._(8, "SIGFPE"); 320 static const ProcessSignal SIGFPE = const ProcessSignal._signal(8);
322 static const ProcessSignal SIGKILL = const ProcessSignal._(9, "SIGKILL"); 321 static const ProcessSignal SIGKILL = const ProcessSignal._signal(9);
323 static const ProcessSignal SIGUSR1 = const ProcessSignal._(10, "SIGUSR1"); 322 static const ProcessSignal SIGUSR1 = const ProcessSignal._signal(10);
324 static const ProcessSignal SIGSEGV = const ProcessSignal._(11, "SIGSEGV"); 323 static const ProcessSignal SIGSEGV = const ProcessSignal._signal(11);
325 static const ProcessSignal SIGUSR2 = const ProcessSignal._(12, "SIGUSR2"); 324 static const ProcessSignal SIGUSR2 = const ProcessSignal._signal(12);
326 static const ProcessSignal SIGPIPE = const ProcessSignal._(13, "SIGPIPE"); 325 static const ProcessSignal SIGPIPE = const ProcessSignal._signal(13);
327 static const ProcessSignal SIGALRM = const ProcessSignal._(14, "SIGALRM"); 326 static const ProcessSignal SIGALRM = const ProcessSignal._signal(14);
328 static const ProcessSignal SIGTERM = const ProcessSignal._(15, "SIGTERM"); 327 static const ProcessSignal SIGTERM = const ProcessSignal._signal(15);
329 static const ProcessSignal SIGCHLD = const ProcessSignal._(17, "SIGCHLD"); 328 static const ProcessSignal SIGCHLD = const ProcessSignal._signal(17);
330 static const ProcessSignal SIGCONT = const ProcessSignal._(18, "SIGCONT"); 329 static const ProcessSignal SIGCONT = const ProcessSignal._signal(18);
331 static const ProcessSignal SIGSTOP = const ProcessSignal._(19, "SIGSTOP"); 330 static const ProcessSignal SIGSTOP = const ProcessSignal._signal(19);
332 static const ProcessSignal SIGTSTP = const ProcessSignal._(20, "SIGTSTP"); 331 static const ProcessSignal SIGTSTP = const ProcessSignal._signal(20);
333 static const ProcessSignal SIGTTIN = const ProcessSignal._(21, "SIGTTIN"); 332 static const ProcessSignal SIGTTIN = const ProcessSignal._signal(21);
334 static const ProcessSignal SIGTTOU = const ProcessSignal._(22, "SIGTTOU"); 333 static const ProcessSignal SIGTTOU = const ProcessSignal._signal(22);
335 static const ProcessSignal SIGURG = const ProcessSignal._(23, "SIGURG"); 334 static const ProcessSignal SIGURG = const ProcessSignal._signal(23);
336 static const ProcessSignal SIGXCPU = const ProcessSignal._(24, "SIGXCPU"); 335 static const ProcessSignal SIGXCPU = const ProcessSignal._signal(24);
337 static const ProcessSignal SIGXFSZ = const ProcessSignal._(25, "SIGXFSZ"); 336 static const ProcessSignal SIGXFSZ = const ProcessSignal._signal(25);
338 static const ProcessSignal SIGVTALRM = const ProcessSignal._(26, "SIGVTALRM"); 337 static const ProcessSignal SIGVTALRM = const ProcessSignal._signal(26);
339 static const ProcessSignal SIGPROF = const ProcessSignal._(27, "SIGPROF"); 338 static const ProcessSignal SIGPROF = const ProcessSignal._signal(27);
340 static const ProcessSignal SIGWINCH = const ProcessSignal._(28, "SIGWINCH"); 339 static const ProcessSignal SIGPOLL = const ProcessSignal._signal(29);
341 static const ProcessSignal SIGPOLL = const ProcessSignal._(29, "SIGPOLL"); 340 static const ProcessSignal SIGSYS = const ProcessSignal._signal(31);
342 static const ProcessSignal SIGSYS = const ProcessSignal._(31, "SIGSYS");
343 341
342 const ProcessSignal._signal(int this._signalNumber);
344 final int _signalNumber; 343 final int _signalNumber;
345 final String _name;
346
347 const ProcessSignal._(this._signalNumber, this._name);
348
349 String toString() => _name;
350
351 Stream<ProcessSignal> watch() => _ProcessUtils._watchSignal(this);
352 } 344 }
353 345
354 346
355 class SignalException implements IOException {
356 final String message;
357 final osError;
358
359 const SignalException(String this.message, [this.osError = null]);
360
361 String toString() {
362 var msg = "";
363 if (osError != null) {
364 msg = ", osError: $osError";
365 }
366 return "SignalException: $message$msg";
367 }
368 }
369
370
371 class ProcessException implements IOException { 347 class ProcessException implements IOException {
372 const ProcessException(String this.executable, 348 const ProcessException(String this.executable,
373 List<String> this.arguments, 349 List<String> this.arguments,
374 [String this.message = "", 350 [String this.message = "",
375 int this.errorCode = 0]); 351 int this.errorCode = 0]);
376 String toString() { 352 String toString() {
377 var msg = (message == null) ? 'OS error code: $errorCode' : message; 353 var msg = (message == null) ? 'OS error code: $errorCode' : message;
378 var args = arguments.join(' '); 354 var args = arguments.join(' ');
379 return "ProcessException: $msg\n Command: $executable $args"; 355 return "ProcessException: $msg\n Command: $executable $args";
380 } 356 }
(...skipping 11 matching lines...) Expand all
392 /** 368 /**
393 * Contains the system message for the process exception if any. 369 * Contains the system message for the process exception if any.
394 */ 370 */
395 final String message; 371 final String message;
396 372
397 /** 373 /**
398 * Contains the OS error code for the process exception if any. 374 * Contains the OS error code for the process exception if any.
399 */ 375 */
400 final int errorCode; 376 final int errorCode;
401 } 377 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/io_patch.dart ('k') | tests/standalone/io/signals_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698