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

Code review: Deno.exit vs exitWithCleanup #10332

Closed
cscheid opened this issue Jul 19, 2024 · 0 comments · Fixed by #10333
Closed

Code review: Deno.exit vs exitWithCleanup #10332

cscheid opened this issue Jul 19, 2024 · 0 comments · Fixed by #10333
Assignees
Milestone

Comments

@cscheid
Copy link
Collaborator

cscheid commented Jul 19, 2024

I made a bad change that caused CRAN failures by using Deno.exit(1) to force an exit status. That hard exit only came up on badly-formed commands (eg. quarto redner file.qmd), but it was enough to trigger a CRAN failure (for which I'm super grateful!)

We have other suspicious instances of Deno.exit() in our code base, and should review them before 1.6 is out. This is the rg output:

$ rg Deno.exit
tools/find-bad-imports.ts
25:    Deno.exit(1);
50:  Deno.exit(1);

src/vendor/deno.land/x/[email protected]/src/parser.ts
7:  Deno.exit(1);
12:  Deno.exit(1);

tools/render-all-formats.ts
100:          Deno.exit(1);
126:              Deno.exit(1);
143:    Deno.exit(1);
153:    Deno.exit(1);

src/vendor/deno.land/x/[email protected]/command/help/help_command.ts
32:          Deno.exit(0);

src/vendor/deno.land/x/[email protected]/command/command.ts
1123:   * Throw validation errors instead of calling `Deno.exit()` to handle
1146:   *     Deno.exit(1);
1175:   * Same as `.throwErrors()` but also prevents calling `Deno.exit` after
1985:        Deno.exit(output.code);
2208:   * otherwise a formatted error message will be printed and `Deno.exit(1)`
2226:    Deno.exit(error instanceof ValidationError ? error.exitCode : 1);
2391:      Deno.exit(code);

src/vendor/deno.land/x/[email protected]/command/upgrade/upgrade_command.ts
53:            Deno.exit(0);

package/src/common/import-report/explain-import-chain.ts
25:    Deno.exit(1);
173:    Deno.exit(1);

package/src/common/import-report/explain-all-cycles.ts
101:    Deno.exit(1);
170:    Deno.exit(1);

package/src/common/import-report/report-risky-files.ts
53:    Deno.exit(1);
64:    Deno.exit(code);

src/vendor/deno.land/x/[email protected]/prompt/_generic_prompt.ts
318:        Deno.exit(130);

src/quarto.ts
65:      Deno.exit(1);
75:    Deno.exit(result.code);
85:      Deno.exit(1);
91:    Deno.exit(result.code);
97:    Deno.exit(result.code);

src/vendor/deno.land/[email protected]/http/file_server.ts
777:    Deno.exit();
782:    Deno.exit();
789:      Deno.exit(1);

src/core/lib/external/tree-sitter-deno.js
125:    Deno.exit(status);

src/core/cleanup.ts
24:  Deno.exit(code);

src/command/serve/cmd.ts
63:      Deno.exit(1);
91:      Deno.exit(result.code);

src/command/run/run.ts
17:    Deno.exit(1);
21:    Deno.exit(1);
26:    Deno.exit(1);

src/command/preview/cmd.ts
317:            Deno.exit(result.code);
331:            Deno.exit(result.code);

tests/run-parallel-tests.ts
33:  Deno.exit(1);
136:// Deno.exit(0);
225:  Deno.exit(0);

cc @cderv

@cscheid cscheid self-assigned this Jul 19, 2024
@cscheid cscheid added this to the v1.6 milestone Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant