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

Side by Side Diff: runtime/bin/builtin.dart

Issue 8574002: Handle stdin/stdout/stderr on Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments from ager@ Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/builtin_in.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("builtin"); 5 #library("builtin");
6 6
7 void print(arg) { 7 void print(arg) {
8 _Logger._printString(arg.toString()); 8 _Logger._printString(arg.toString());
9 } 9 }
10 10
11 void exit(int status) { 11 void exit(int status) {
12 if (status is !int) { 12 if (status is !int) {
13 throw new IllegalArgumentException("int status expected"); 13 throw new IllegalArgumentException("int status expected");
14 } 14 }
15 _exit(status); 15 _exit(status);
16 } 16 }
17 17
18 Socket _stdin; 18 Socket _stdin;
19 OutputStream get stdin() { 19 OutputStream get stdin() {
20 if (_stdin == null) { 20 if (_stdin == null) {
21 _stdin = new _Socket._internalReadOnly(); 21 _stdin = new _Socket._internalReadOnly();
22 _stdin._id = 0; 22 _getStdioHandle(_stdin, 0);
23 } 23 }
24 return _stdin.inputStream; 24 return _stdin.inputStream;
25 } 25 }
26 26
27 Socket _stdout; 27 Socket _stdout;
28 OutputStream get stdout() { 28 OutputStream get stdout() {
29 if (_stdout == null) { 29 if (_stdout == null) {
30 _stdout = new _Socket._internalWriteOnly(); 30 _stdout = new _Socket._internalWriteOnly();
31 _stdout._id = 1; 31 _getStdioHandle(_stdout, 1);
32 } 32 }
33 return _stdout.outputStream; 33 return _stdout.outputStream;
34 } 34 }
35 35
36 Socket _stderr; 36 Socket _stderr;
37 OutputStream get stderr() { 37 OutputStream get stderr() {
38 if (_stderr == null) { 38 if (_stderr == null) {
39 _stderr = new _Socket._internalWriteOnly(); 39 _stderr = new _Socket._internalWriteOnly();
40 _stderr._id = 2; 40 _getStdioHandle(_stderr, 2);
41 } 41 }
42 return _stderr.outputStream; 42 return _stderr.outputStream;
43 } 43 }
44 44
45 _exit(int status) native "Exit"; 45 _exit(int status) native "Exit";
46 46
47 _getStdioHandle(Socket socket, int num) native "Socket_GetStdioHandle";
48
47 class _Logger { 49 class _Logger {
48 static void _printString(String s) native "Logger_PrintString"; 50 static void _printString(String s) native "Logger_PrintString";
49 } 51 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/builtin_in.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698