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

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

Issue 11665004: Add exitCode setter to set the exit code returned by the Dart VM (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 12 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
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 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 _exit(int status); 10 external static _exit(int status);
11 external static _setExitCode(int status);
11 } 12 }
12 13
13 /** Exit the Dart VM process with the given [status] code. */ 14 /**
15 * Exit the Dart VM process immediately with the given [status] code.
16 *
17 * This does not wait for any asynchronous operations to terminate. Using
18 * [exit] is therefore very likely to lose data.
19 */
14 void exit(int status) { 20 void exit(int status) {
15 if (status is !int) { 21 if (status is !int) {
16 throw new ArgumentError("int status expected"); 22 throw new ArgumentError("exit: int status expected");
17 } 23 }
18 _ProcessUtils._exit(status); 24 _ProcessUtils._exit(status);
19 } 25 }
20 26
21 /** 27 /**
28 * Global exit code for the Dart VM.
29 *
30 * The exit code is global for the Dart VM and the last assignment to
31 * exitCode from any isolate determines the exit code of the Dart VM
32 * on normal termination.
33 */
34 set exitCode(int status) {
35 if (status is !int) {
36 throw new ArgumentError("setExitCode: int status expected");
37 }
38 _ProcessUtils._setExitCode(status);
39 }
40
41 /**
22 * [Process] is used to start new processes using the static 42 * [Process] is used to start new processes using the static
23 * [start] and [run] methods. 43 * [start] and [run] methods.
24 */ 44 */
25 abstract class Process { 45 abstract class Process {
26 /** 46 /**
27 * Starts a process running the [executable] with the specified 47 * Starts a process running the [executable] with the specified
28 * [arguments]. Returns a [:Future<Process>:] that completes with a 48 * [arguments]. Returns a [:Future<Process>:] that completes with a
29 * Process instance when the process has been successfully 49 * Process instance when the process has been successfully
30 * started. That [Process] object can be used to interact with the 50 * started. That [Process] object can be used to interact with the
31 * process. If the process cannot be started the returned [Future] 51 * process. If the process cannot be started the returned [Future]
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 /** 259 /**
240 * Contains the system message for the process exception if any. 260 * Contains the system message for the process exception if any.
241 */ 261 */
242 final String message; 262 final String message;
243 263
244 /** 264 /**
245 * Contains the OS error code for the process exception if any. 265 * Contains the OS error code for the process exception if any.
246 */ 266 */
247 final int errorCode; 267 final int errorCode;
248 } 268 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/io_patch.dart ('k') | tests/standalone/io/process_set_exit_code_script.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698