e725e8edf2
Closes https://github.com/dart-lang/sdk/issues/40571. Change-Id: I38704ab2583f4e856866f091ac652a8a652abe54 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137101 Reviewed-by: William Hesse <whesse@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Jonas Termansen <sortie@google.com>
49 lines
1.3 KiB
Dart
49 lines
1.3 KiB
Dart
// Copyright (c) 2013, 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.
|
|
//
|
|
// Process test program to test process communication.
|
|
//
|
|
// VMOptions=
|
|
// VMOptions=--short_socket_read
|
|
// VMOptions=--short_socket_write
|
|
// VMOptions=--short_socket_read --short_socket_write
|
|
|
|
import "package:expect/expect.dart";
|
|
import 'dart:async';
|
|
import 'dart:io';
|
|
import 'dart:math';
|
|
|
|
import "process_test_util.dart";
|
|
|
|
void test(Future<Process> future, int expectedExitCode) {
|
|
future.then((process) {
|
|
process.exitCode.then((exitCode) {
|
|
Expect.equals(expectedExitCode, exitCode);
|
|
});
|
|
|
|
process.stdout.listen((_) {});
|
|
process.stderr.listen((_) {});
|
|
process.stdin.writeln("Line1");
|
|
process.stdin.flush().then((_) {
|
|
print("flush completed");
|
|
});
|
|
});
|
|
}
|
|
|
|
main() {
|
|
var scriptName = "process_stdin_transform_unsubscribe_script.dart";
|
|
var scriptFile = new File("tests/standalone/io/$scriptName");
|
|
if (!scriptFile.existsSync()) {
|
|
scriptFile = new File("../tests/standalone/io/$scriptName");
|
|
}
|
|
Expect.isTrue(scriptFile.existsSync());
|
|
test(
|
|
Process.start(
|
|
Platform.executable,
|
|
[]
|
|
..addAll(Platform.executableArguments)
|
|
..add(scriptFile.path)),
|
|
0);
|
|
}
|