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

Add forceExit CLI flag #5195

Merged
merged 5 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@
// do nothing
}

run(command);
const promise = run(command);
if (command.forceExit) {
// eslint-disable-next-line unicorn/no-process-exit
promise.then(() => process.exit());

Check warning on line 29 in cli/cli.ts

View check run for this annotation

Codecov / codecov/patch

cli/cli.ts#L29

Added line #L29 was not covered by tests
}
}
1 change: 1 addition & 0 deletions cli/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Basic options:
--failAfterWarnings Exit with an error if the build produced warnings
--filterLogs <filter> Filter log messages
--footer <text> Code to insert at end of bundle (outside wrapper)
--forceExit Force exit the process when done
--no-freeze Do not freeze namespace objects
--generatedCode <preset> Which code features to use (es5/es2015)
--generatedCode.arrowFunctions Use arrow functions in generated code
Expand Down
7 changes: 7 additions & 0 deletions docs/command-line-interface/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ Many options have command line equivalents. In those cases, any arguments passed
--failAfterWarnings Exit with an error if the build produced warnings
--filterLogs <filter> Filter log messages
--footer <text> Code to insert at end of bundle (outside wrapper)
--forceExit Force exit the process when done
--no-freeze Do not freeze namespace objects
--generatedCode <preset> Which code features to use (es5/es2015)
--generatedCode.arrowFunctions Use arrow functions in generated code
Expand Down Expand Up @@ -556,6 +557,12 @@ There is also some advanced syntax available for more complex filters.

will only display logs where the property `log.foo.bar` has the value `"value"`.

### `--forceExit`

Force exit the process when done. In some cases plugins or their dependencies might not cleanup properly and prevent the CLI process from exiting. The root cause can be hard to diagnose and this flag provides an escape hatch until it can be identified and resolved.

Note that this might break certain workflows and won't always work properly.

### `-h`/`--help`

Print the help document.
Expand Down