File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -57,12 +57,12 @@ pub async fn run_main(args: Vec<String>) -> Result<()> {
5757 }
5858
5959 if cli. source_options . repo_root != "." {
60- env:: set_current_dir ( Path :: new ( & cli. source_options . repo_root ) ) . unwrap_or_else ( |_ | {
61- panic ! (
62- "'{}' is inaccessible or does not exist" ,
60+ env:: set_current_dir ( Path :: new ( & cli. source_options . repo_root ) ) . map_err ( |e | {
61+ anyhow ! (
62+ "'{}' is inaccessible or does not exist: {e:?} " ,
6363 cli. source_options. repo_root
6464 )
65- } ) ;
65+ } ) ? ;
6666 }
6767
6868 let rest_api_client = GithubApiClient :: new ( ) ?;
@@ -240,4 +240,16 @@ mod test {
240240 . await ;
241241 assert ! ( result. is_ok( ) ) ;
242242 }
243+
244+ #[ tokio:: test]
245+ async fn bad_repo_root ( ) {
246+ env:: remove_var ( "GITHUB_OUTPUT" ) ; // avoid writing to GH_OUT in parallel-running tests
247+ let result = run_main ( vec ! [
248+ "cpp-linter" . to_string( ) ,
249+ "-r" . to_string( ) ,
250+ "some-non-existent-dir" . to_string( ) ,
251+ ] )
252+ . await ;
253+ assert ! ( result. is_err( ) ) ;
254+ }
243255}
You can’t perform that action at this time.
0 commit comments