Skip to content

Commit

Permalink
main : gracefully exit when invalid params are passed (ggerganov#1002)
Browse files Browse the repository at this point in the history
* Refactor whisper_params_parse to return false on failure

* Updated help flag behavior
  • Loading branch information
faker2048 authored Jun 25, 2023
1 parent 3ec7bff commit 598f607
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
else if (arg == "-f" || arg == "--file") { params.fname_inp.emplace_back(argv[++i]); }
else {
fprintf(stderr, "error: unknown argument: %s\n", arg.c_str());
whisper_print_usage(argc, argv, params);
exit(0);
return false;
}
}

Expand Down Expand Up @@ -689,6 +688,7 @@ int main(int argc, char ** argv) {
whisper_params params;

if (whisper_params_parse(argc, argv, params) == false) {
whisper_print_usage(argc, argv, params);
return 1;
}

Expand Down

0 comments on commit 598f607

Please sign in to comment.