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

fix(cli): fix panic when no paths are provided #944

Merged
merged 4 commits into from
Sep 30, 2023

Conversation

camc314
Copy link
Collaborator

@camc314 camc314 commented Sep 29, 2023

We now print the following error if no paths are provided:

e.g.:

$ cargo run --bin=oxc_cli -- lint
    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/oxc_cli lint`
Error: want at least one path

Previously, it paniced as we tried to index into a zero length array:

e.g.:

$ cargo run --bin=oxc_cli -- lint
    Finished dev [unoptimized + debuginfo] target(s) in 1.33s
     Running `target/debug/oxc_cli lint`
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', crates/oxc_cli/src/walk.rs:61:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

.gitignore Outdated Show resolved Hide resolved
@codspeed-hq
Copy link

codspeed-hq bot commented Sep 29, 2023

CodSpeed Performance Report

Merging #944 will not alter performance

⚠️ No base runs were found

Falling back to comparing camc314:c/fix-cli-panic (3e94e67) with main (85b113d)

Summary

✅ 18 untouched benchmarks

@Boshen Boshen merged commit d5b70c3 into oxc-project:main Sep 30, 2023
17 checks passed
@camc314 camc314 deleted the c/fix-cli-panic branch September 30, 2023 09:15
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.

2 participants