OLD | NEW |
| (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 import 'dart:io'; | |
6 | |
7 import '../descriptor.dart' as d; | |
8 import '../test_pub.dart'; | |
9 | |
10 const _catchableSignals = const [ | |
11 ProcessSignal.SIGHUP, | |
12 ProcessSignal.SIGTERM, | |
13 ProcessSignal.SIGUSR1, | |
14 ProcessSignal.SIGUSR2, | |
15 ProcessSignal.SIGWINCH, | |
16 ]; | |
17 | |
18 const SCRIPT = """ | |
19 import 'dart:io'; | |
20 | |
21 main() { | |
22 ProcessSignal.SIGHUP.watch().first.then(print); | |
23 ProcessSignal.SIGTERM.watch().first.then(print); | |
24 ProcessSignal.SIGUSR1.watch().first.then(print); | |
25 ProcessSignal.SIGUSR2.watch().first.then(print); | |
26 ProcessSignal.SIGWINCH.watch().first.then(print); | |
27 | |
28 print("ready"); | |
29 } | |
30 """; | |
31 | |
32 main() { | |
33 initConfig(); | |
34 integration('forwards signals to the inner script', () { | |
35 d.dir(appPath, [ | |
36 d.appPubspec(), | |
37 d.dir("bin", [ | |
38 d.file("script.dart", SCRIPT) | |
39 ]) | |
40 ]).create(); | |
41 | |
42 var pub = pubRun(args: ["bin/script"]); | |
43 | |
44 pub.stdout.expect("ready"); | |
45 for (var signal in _catchableSignals) { | |
46 pub.signal(signal); | |
47 pub.stdout.expect(signal.toString()); | |
48 } | |
49 | |
50 pub.kill(); | |
51 }); | |
52 } | |
OLD | NEW |