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 calls to process.exit() #1380

Open
samayer12 opened this issue Nov 4, 2024 · 0 comments
Open

Remove calls to process.exit() #1380

samayer12 opened this issue Nov 4, 2024 · 0 comments

Comments

@samayer12
Copy link
Collaborator

Describe what should be investigated or refactored

There are several spots where Pepr calls process.exit(). This complicates the ability to do global logging, auditing, or cleanup. We should avoid this pattern to handle failure cases in a more graceful manner. Consider this explanation for why it's a bad idea.

We'll know we're done with this issue when each of those calls to process.exit() handle shutdown in a more graceful manner (e.g., throwing exceptions, passing control to some other function, etc.)

Links to any relevant code

src/cli/build.ts:          process.exit(1);
src/cli/build.ts:            process.exit(1);
src/cli/build.ts:            process.exit(1);
src/cli/build.ts:          process.exit(1);
src/cli/build.ts:    process.exit(1);
src/cli/build.ts:    if (!e.stdout) process.exit(1); // Exit with a non-zero exit code on any other error
src/cli/deploy.ts:        process.exit(1);
src/cli/deploy.ts:        process.exit(1);
src/cli/deploy.ts:          process.exit(0);
src/cli/deploy.ts:          process.exit(1);
src/cli/dev.ts:          process.exit(0);
src/cli/dev.ts:            process.exit(1);
src/cli/dev.ts:        process.exit(1);
src/cli/format.ts:        process.exit(1);
src/cli/init/index.ts:          process.exit(1);
src/cli/kfc.ts:        process.exit(1);
src/cli/monitor.ts:        process.exit(1);
src/cli/update.ts:        process.exit(1);
src/cli/update.ts:        process.exit(1);
src/lib/assets/index.ts:      process.exit(1);
src/lib/assets/pods.ts:    process.exit(1);
src/lib/controller/index.ts:        process.exit(0);
src/lib/module.ts:          process.exit(1);
src/lib/watch-processor.ts:    process.exit(1);
src/lib/watch-processor.ts:    process.exit(1);
src/runtime/controller.ts:    process.exit(1);

Additional context

Generate the above list with the command grep "process.exit(" src/**/*.*s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant