mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 04:39:10 +00:00
Expose deno.exit() and add test.
This commit is contained in:
parent
18d495c7d1
commit
790baae673
6 changed files with 40 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue