blob: 781f734577b6b8ea44e3d2ee244aadd16b6462c4 [file] [log] [blame]
// 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.
// Regression test for http://dartbug.com/7191.
// Starts a sub-process which in turn starts another sub-process and then closes
// its standard output. If handles are incorrectly inherited on Windows, this
// will lead to a situation where the stdout of the first sub-process is never
// closed which will make this test hang.
import 'dart:io';
import 'dart:isolate';
import 'package:path/path.dart';
main() {
var port = new ReceivePort();
var executable = Platform.executable;
var script = join(dirname(Platform.script), 'regress_7191_script.dart');
Process.start(executable, [script]).then((process) {
process.stdin.add([0]);
process.stdout.listen((_) { },
onDone: () { process.stdin.add([0]); });
process.stderr.listen((_) { });
process.exitCode.then((exitCode) {
port.close();
if (exitCode != 0) throw "Bad exit code";
});
});
}