| OLD | NEW |
| 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 class _ProcessStartStatus { | 5 class _ProcessStartStatus { |
| 6 int _errorCode; // Set to OS error code if process start failed. | 6 int _errorCode; // Set to OS error code if process start failed. |
| 7 String _errorMessage; // Set to OS error message if process start failed. | 7 String _errorMessage; // Set to OS error message if process start failed. |
| 8 } | 8 } |
| 9 | 9 |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 115 } |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 void _kill(int pid) native "Process_Kill"; | 119 void _kill(int pid) native "Process_Kill"; |
| 120 | 120 |
| 121 void close() { | 121 void close() { |
| 122 if (_closed) { | 122 if (_closed) { |
| 123 throw new ProcessException("Process closed"); | 123 throw new ProcessException("Process closed"); |
| 124 } | 124 } |
| 125 if (_in._id != 0) { _in.close(); } | 125 _in.close(); |
| 126 if (_out._id != 0) { _out.close(); } | 126 _out.close(); |
| 127 if (_err._id != 0) { _err.close(); } | 127 _err.close(); |
| 128 if (_exitHandler._id != 0) { _exitHandler.close(); } | 128 _exitHandler.close(); |
| 129 _closed = true; | 129 _closed = true; |
| 130 } | 130 } |
| 131 | 131 |
| 132 void setExitHandler(void callback(int exitCode)) { | 132 void setExitHandler(void callback(int exitCode)) { |
| 133 if (_closed) { | 133 if (_closed) { |
| 134 throw new ProcessException("Process closed"); | 134 throw new ProcessException("Process closed"); |
| 135 } | 135 } |
| 136 if (_killed) { | 136 if (_killed) { |
| 137 throw new ProcessException("Process killed"); | 137 throw new ProcessException("Process killed"); |
| 138 } | 138 } |
| 139 _exitHandlerCallback = callback; | 139 _exitHandlerCallback = callback; |
| 140 } | 140 } |
| 141 | 141 |
| 142 String _path; | 142 String _path; |
| 143 ObjectArray<String> _arguments; | 143 ObjectArray<String> _arguments; |
| 144 Socket _in; | 144 Socket _in; |
| 145 Socket _out; | 145 Socket _out; |
| 146 Socket _err; | 146 Socket _err; |
| 147 Socket _exitHandler; | 147 Socket _exitHandler; |
| 148 int _pid; | 148 int _pid; |
| 149 bool _closed; | 149 bool _closed; |
| 150 bool _killed; | 150 bool _killed; |
| 151 bool _started; | 151 bool _started; |
| 152 var _exitHandlerCallback; | 152 var _exitHandlerCallback; |
| 153 } | 153 } |
| OLD | NEW |