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 # This file contains a set of utilities functions used by other Python-based | 5 # This file contains a set of utilities functions used by other Python-based |
6 # scripts. | 6 # scripts. |
7 | 7 |
8 import commands | 8 import commands |
9 import os | 9 import os |
10 import platform | 10 import platform |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 """ | 189 """ |
190 if os.fork() > 0: | 190 if os.fork() > 0: |
191 return False | 191 return False |
192 os.setsid() | 192 os.setsid() |
193 if os.fork() > 0: | 193 if os.fork() > 0: |
194 os._exit(0) | 194 os._exit(0) |
195 raise | 195 raise |
196 return True | 196 return True |
197 | 197 |
198 | 198 |
| 199 def PrintError(str): |
| 200 sys.stderr.write(str) |
| 201 sys.stderr.write('\n') |
| 202 |
| 203 |
199 def Main(argv): | 204 def Main(argv): |
200 print "GuessOS() -> ", GuessOS() | 205 print "GuessOS() -> ", GuessOS() |
201 print "GuessArchitecture() -> ", GuessArchitecture() | 206 print "GuessArchitecture() -> ", GuessArchitecture() |
202 print "GuessCpus() -> ", GuessCpus() | 207 print "GuessCpus() -> ", GuessCpus() |
203 print "IsWindows() -> ", IsWindows() | 208 print "IsWindows() -> ", IsWindows() |
204 | 209 |
205 | 210 |
206 class Error(Exception): | 211 class Error(Exception): |
207 pass | 212 pass |
208 | 213 |
209 | 214 |
210 class ToolError(Exception): | 215 class ToolError(Exception): |
211 """Deprecated exception, use Error instead.""" | 216 """Deprecated exception, use Error instead.""" |
212 | 217 |
213 def __init__(self, value): | 218 def __init__(self, value): |
214 self.value = value | 219 self.value = value |
215 | 220 |
216 def __str__(self): | 221 def __str__(self): |
217 return repr(self.value) | 222 return repr(self.value) |
218 | 223 |
219 | 224 |
220 if __name__ == "__main__": | 225 if __name__ == "__main__": |
221 import sys | 226 import sys |
222 Main(sys.argv) | 227 Main(sys.argv) |
OLD | NEW |