Skip to content

Commit

Permalink
🚸 Use different exit codes for compilation error and detections found
Browse files Browse the repository at this point in the history
  • Loading branch information
michprev committed Oct 25, 2023
1 parent 5d5dd56 commit 3210af0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion woke/cli/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async def compile(
error.severity == SolcOutputErrorSeverityEnum.ERROR for error in errors
)
if errored:
sys.exit(1)
sys.exit(2)


@click.command(name="compile")
Expand Down
5 changes: 2 additions & 3 deletions woke/cli/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def callback(build: ProjectBuild, build_info: ProjectBuildInfo):
if watch:
return
else:
sys.exit(1)
sys.exit(2)

assert compiler.latest_graph is not None
assert ctx.invoked_subcommand is not None
Expand Down Expand Up @@ -401,8 +401,7 @@ def callback(build: ProjectBuild, build_info: ProjectBuildInfo):
console.record = False

if not watch:
# TODO different error exit codes for compilation/detection errors
sys.exit(0 if len(detections) == 0 else 1)
sys.exit(0 if len(detections) == 0 else 3)

sol_files: Set[Path] = set()
start = time.perf_counter()
Expand Down
2 changes: 1 addition & 1 deletion woke/cli/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def callback(build: ProjectBuild, build_info: ProjectBuildInfo):
else:
errored = any(e.severity == SolcOutputErrorSeverityEnum.ERROR for e in errors)
if errored:
sys.exit(1)
sys.exit(2)


@run_init.command(name="pytypes")
Expand Down
2 changes: 1 addition & 1 deletion woke/cli/print.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def callback(build: ProjectBuild, build_info: ProjectBuildInfo):
if watch:
return
else:
sys.exit(1)
sys.exit(2)

if export is not None:
console.record = True
Expand Down

0 comments on commit 3210af0

Please sign in to comment.