Skip to content

Commit

Permalink
Gracefully exit if semgrep scan --pro is called before install (#8746)
Browse files Browse the repository at this point in the history
Currently, if `semgrep scan --pro --config auto` is called before the
Pro Engine binary is installed, semgrep crashes. This gracefully exits
instead.

PR checklist:

- [X] Purpose of the code is [evident to future
readers](https://semgrep.dev/docs/contributing/contributing-code/#explaining-code)
- [x] Tests included or PR comment includes a reproducible test plan
- [x] Documentation is up-to-date
- [x] A changelog entry was [added to
changelog.d](https://semgrep.dev/docs/contributing/contributing-code/#adding-a-changelog-entry)
for any user-facing change
- [x] Change has no security implications (otherwise, ping security
team)

If you're unsure about any of this, please see:

- [Contribution
guidelines](https://semgrep.dev/docs/contributing/contributing-code)!
- [One of the more specific guides located
here](https://semgrep.dev/docs/contributing/contributing/)
  • Loading branch information
sinat101 authored Sep 18, 2023
1 parent 899505b commit 565f5fd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cli/bin/semgrep
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def exec_osemgrep():
# to install semgrep-pro, however, so have them run legacy `semgrep`.
print("Since `semgrep ci` was run, defaulting to legacy semgrep", file=sys.stderr)
exec_pysemgrep()
else:
sys.exit(2)
# If you call semgrep-core-proprietary as osemgrep-pro, then we get
# osemgrep-pro behavior, see semgrep-proprietary/src/main/Pro_main.ml
sys.argv[0] = "osemgrep-pro"
Expand Down

0 comments on commit 565f5fd

Please sign in to comment.