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

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

Issue 300883002: Add Proces owner of socket and fix printing of non-network sockets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/service_object_patch.dart » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 patch class _WindowsCodePageDecoder { 5 patch class _WindowsCodePageDecoder {
6 /* patch */ static String _decodeBytes(List<int> bytes) 6 /* patch */ static String _decodeBytes(List<int> bytes)
7 native "SystemEncodingToString"; 7 native "SystemEncodingToString";
8 } 8 }
9 9
10 10
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 assert(value is String); 223 assert(value is String);
224 // Do not override keys already set as part of environment. 224 // Do not override keys already set as part of environment.
225 if (!environment.containsKey(key)) { 225 if (!environment.containsKey(key)) {
226 _environment.add('$key=$value'); 226 _environment.add('$key=$value');
227 } 227 }
228 }); 228 });
229 } 229 }
230 230
231 // stdin going to process. 231 // stdin going to process.
232 _stdin = new _StdSink(new _Socket._writePipe()); 232 _stdin = new _StdSink(new _Socket._writePipe());
233 _stdin._sink._owner = this;
233 // stdout coming from process. 234 // stdout coming from process.
234 _stdout = new _StdStream(new _Socket._readPipe()); 235 _stdout = new _StdStream(new _Socket._readPipe());
236 _stdout._stream._owner = this;
235 // stderr coming from process. 237 // stderr coming from process.
236 _stderr = new _StdStream(new _Socket._readPipe()); 238 _stderr = new _StdStream(new _Socket._readPipe());
239 _stderr._stream._owner = this;
237 _exitHandler = new _Socket._readPipe(); 240 _exitHandler = new _Socket._readPipe();
238 _ended = false; 241 _ended = false;
239 _started = false; 242 _started = false;
240 } 243 }
241 244
242 String get _serviceTypePath => 'io/processes'; 245 String get _serviceTypePath => 'io/processes';
243 String get _serviceTypeName => 'Process'; 246 String get _serviceTypeName => 'Process';
244 247
245 Map _toJSON(bool ref) { 248 Map _toJSON(bool ref) {
246 var r = { 249 var r = {
247 'id': _servicePath, 250 'id': _servicePath,
248 'type': _serviceType(ref), 251 'type': _serviceType(ref),
249 'name': '$_path', 252 'name': '$_path',
250 'user_name': '$_path', 253 'user_name': '$_path',
251 'pid': '$pid', 254 'pid': '$pid',
252 'arguments': _arguments.join(' '), 255 'arguments': _arguments.join(' '),
253 }; 256 };
254 if (ref) { 257 if (ref) {
255 return r; 258 return r;
256 } 259 }
257 r['started'] = _started; 260 r['started'] = _started;
258 r['ended'] = _ended; 261 r['ended'] = _ended;
259 r['path'] = _path; 262 r['path'] = _path;
260 r['environment'] = _environment; 263 r['environment'] = _environment;
261 r['workingDirectory'] = _workingDirectory == null ? '.' : _workingDirectory; 264 r['workingDirectory'] = _workingDirectory == null ? '.' : _workingDirectory;
265 if (_stdin._sink._nativeSocket.owner != null) {
266 r['stdin'] = _stdin._sink._nativeSocket._toJSON(true);
267 }
268 if (_stdout._stream._nativeSocket.owner != null) {
269 r['stdout'] = _stdout._stream._nativeSocket._toJSON(true);
270 }
271 if (_stderr._stream._nativeSocket.owner != null) {
272 r['stderr'] = _stderr._stream._nativeSocket._toJSON(true);
273 }
262 return r; 274 return r;
263 } 275 }
264 276
265 static String _getShellCommand() { 277 static String _getShellCommand() {
266 if (Platform.isWindows) { 278 if (Platform.isWindows) {
267 return 'cmd.exe'; 279 return 'cmd.exe';
268 } 280 }
269 return '/bin/sh'; 281 return '/bin/sh';
270 } 282 }
271 283
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 const _ProcessResult(int this.pid, 589 const _ProcessResult(int this.pid,
578 int this.exitCode, 590 int this.exitCode,
579 this.stdout, 591 this.stdout,
580 this.stderr); 592 this.stderr);
581 593
582 final int pid; 594 final int pid;
583 final int exitCode; 595 final int exitCode;
584 final stdout; 596 final stdout;
585 final stderr; 597 final stderr;
586 } 598 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/service_object_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698