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

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

Issue 1883293005: Allow opening a named pipe on MacOS and Linux. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix comments Created 4 years, 8 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
« no previous file with comments | « runtime/bin/file_macos.cc ('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) 2016, 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 // Testing file input stream, VM-only, standalone test.
5
6 import "dart:convert";
7 import "dart:io";
8
9 import "package:expect/expect.dart";
10
11 main() {
12 // Reading a script from a named pipe is only supported on Linux and MacOS.
13 if (!Platform.isLinux && !Platform.isMacOS) {
14 return;
15 }
16
17 final String script = 'int main() {print("Hello, World!");}';
18 final String stdinPipePath = '/dev/fd/0';
19 StringBuffer output = new StringBuffer();
20 Process.start(Platform.executable, [stdinPipePath]).then((Process process) {
21 process.stdout.transform(UTF8.decoder).listen(output.write);
22 process.stderr.transform(UTF8.decoder).listen((data) {
23 Expect.fail(data);
24 });
25 process.stdin.writeln(script);
26 process.stdin.close();
27 process.exitCode.then((int status) {
28 Expect.equals(0, status);
29 Expect.equals("Hello, World!\n", output.toString());
30 });
31 });
32 }
OLDNEW
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698