diff options
| author | Ryan Dahl <ry@tinyclouds.org> | 2018-08-19 03:00:34 -0400 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2018-08-21 18:34:56 -0400 |
| commit | 790baae673fd60c36f47b9f9b31c9cf132ba3437 (patch) | |
| tree | 8ffd1f1932e8fe0144e5920551449ac1417c68e9 /tools/util.py | |
| parent | 18d495c7d17cf3fce3835e732094d058f51eddaa (diff) | |
Expose deno.exit() and add test.
Diffstat (limited to 'tools/util.py')
| -rw-r--r-- | tools/util.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/util.py b/tools/util.py index 9e29cf742..b50b754c2 100644 --- a/tools/util.py +++ b/tools/util.py @@ -1,5 +1,6 @@ # Copyright 2018 the Deno authors. All rights reserved. MIT license. import os +import re import shutil import stat import sys @@ -162,3 +163,13 @@ def pattern_match(pattern, string, wildcard="[WILDCARD]"): string = string[(found + len(parts[i])):] return len(string) == 0 + + +def parse_exit_code(s): + codes = [int(d or 1) for d in re.findall(r'error(\d*)', s)] + if len(codes) > 1: + assert False, "doesn't support multiple error codes." + elif len(codes) == 1: + return codes[0] + else: + return 0 |
