| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 part of dart.fletch.os; | 5 part of dart.dartino.os; |
| 6 | 6 |
| 7 class NativeProcess { | 7 class NativeProcess { |
| 8 | 8 |
| 9 /// Starts a native (OS) process with stdin, stdout, and stderr detached. | 9 /// Starts a native (OS) process with stdin, stdout, and stderr detached. |
| 10 /// Returns the pid of the spawned process. | 10 /// Returns the pid of the spawned process. |
| 11 static int startDetached(String path, List<String> arguments) { | 11 static int startDetached(String path, List<String> arguments) { |
| 12 List<ForeignMemory> allocated = []; | 12 List<ForeignMemory> allocated = []; |
| 13 | 13 |
| 14 // Helper method to ensure we know what to free. | 14 // Helper method to ensure we know what to free. |
| 15 int allocateString(String str) { | 15 int allocateString(String str) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 45 "${Foreign.errno}"; | 45 "${Foreign.errno}"; |
| 46 } | 46 } |
| 47 return pid; | 47 return pid; |
| 48 } finally { | 48 } finally { |
| 49 for (var memory in allocated) { | 49 for (var memory in allocated) { |
| 50 memory.free(); | 50 memory.free(); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 @fletch.native static int _spawnDetached(int argumentsAddress) { | 55 @dartino.native static int _spawnDetached(int argumentsAddress) { |
| 56 throw new UnsupportedError('_spawnDetached'); | 56 throw new UnsupportedError('_spawnDetached'); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| OLD | NEW |