Files
sdk/tests/standalone/io/signal_test_script.dart
T
Jonas Termansen 3433d8cfc3 [nnbd] Migrate standalone/io to NNBD.
The tests are also now dartfmt.

Bug: https://github.com/dart-lang/sdk/issues/40040
Change-Id: I8dece8097b37b70d47a5374dae2f3fadb0fc4b90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134338
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-02-07 14:41:36 +00:00

42 lines
1.1 KiB
Dart

// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "dart:io";
import "dart:async";
void main(args) {
// This process should die if it never receives a signal.
var timeout = new Timer(new Duration(seconds: 25), () => exit(1));
for (var arg in args) {
var signal;
switch (arg) {
case 'SIGHUP':
signal = ProcessSignal.sighup;
break;
case 'SIGINT':
signal = ProcessSignal.sigint;
break;
case 'SIGTERM':
signal = ProcessSignal.sigterm;
break;
case 'SIGUSR1':
signal = ProcessSignal.sigusr1;
break;
case 'SIGUSR2':
signal = ProcessSignal.sigusr2;
break;
case 'SIGWINCH':
signal = ProcessSignal.sigwinch;
break;
}
signal.watch().first.then((s) {
if (signal != s) exit(1);
if (signal.toString() != arg) exit(1);
print(signal);
exit(0);
});
}
print("ready");
}