Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove exit(1) when no files found to scan #64

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

Janey2022
Copy link
Contributor

No description provided.

@Janey2022
Copy link
Contributor Author

With the origin logic, if I run it in the cases that contains several dirs, it will break when found one has no matched file to scan.

@Janey2022
Copy link
Contributor Author

It seems not a good approach. But still need to handle the issue when the loop exit in some cases.

@FelipeNasci
Copy link

FelipeNasci commented Feb 12, 2023

How about throwing an exception in this case?

That way, we can catch the error with a try{} catch(){}

@Janey2022
Copy link
Contributor Author

Janey2022 commented Feb 13, 2023

How about throwing an exception in this case?

That way, we can catch the error with a try{} catch(){}

Good point, yes, if we use process.exit instead of exception, try catch can't catch process.exit(1).
Should throw exception instead.

@gyfchong
Copy link

Fixes #68

@JulianNymark
Copy link

For those waiting for this to merge; we use the following monkey patch at work. 🐒

  {
    const old_exit = process.exit;
    // @ts-ignore monkey patching
    process.exit = () => {};

    await scanner.run(/* ...code... */);

    process.exit = old_exit;
  }

@moroshko moroshko merged commit acd18fd into moroshko:master Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants