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

Side by Side Diff: tests/standalone/io/process_detached_test.dart

Issue 798743004: Add support for starting a detached process (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 5 years, 11 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 | « tests/standalone/io/process_detached_script.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4 //
5 // Process test program to test detached processes.
6
7 import 'dart:async';
8 import 'dart:io';
9
10 import "package:async_helper/async_helper.dart";
11 import "package:expect/expect.dart";
12
13 import "process_test_util.dart";
14
15 void test() {
16 asyncStart();
17 var script =
18 Platform.script.resolve('process_detached_script.dart').toFilePath();
19 var future = Process.start(Platform.executable, [script], detach: true);
20 future.then((process) {
21 print(process.pid);
22 Expect.isNotNull(process.pid);
23 Expect.isTrue(process.pid is int);
24 Expect.isNull(process.exitCode);
25 Expect.isNull(process.stderr);
26 Expect.isNull(process.stdin);
27 Expect.isNull(process.stdout);
28 Expect.isTrue(process.kill());
29 }).whenComplete(() {
30 asyncEnd();
31 });
32 }
33
34 void testFailure() {
35 asyncStart();
36 Directory.systemTemp.createTemp('dart_detached_process').then((temp) {
37 var future = Process.start(temp.path, ['a', 'b'], detach: true);
38 future.then((process) {
39 Expect.fail('Starting process from invalid executable succeeded');
40 }, onError: (e) {
41 Expect.isTrue(e is ProcessException);
42 }).whenComplete(() {
43 temp.deleteSync();
44 asyncEnd();
45 });
46 });
47 }
48
49 main() {
50 test();
51 testFailure();
52 }
OLDNEW
« no previous file with comments | « tests/standalone/io/process_detached_script.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698