File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ pub fn main(config: &mut LazyConfig) -> CliResult {
28
28
let args = cli ( ) . try_get_matches ( ) ?;
29
29
30
30
// Update the process-level notion of cwd
31
+ // This must be completed before config is initialized
32
+ assert_eq ! ( config. is_init( ) , false ) ;
31
33
if let Some ( new_cwd) = args. get_one :: < std:: path:: PathBuf > ( "directory" ) {
32
34
std:: env:: set_current_dir ( & new_cwd) . context ( "could not change to requested directory" ) ?;
33
35
}
@@ -509,6 +511,13 @@ impl LazyConfig {
509
511
Self { config : None }
510
512
}
511
513
514
+ /// Check whether the config is loaded
515
+ ///
516
+ /// This is useful for asserts in case the environment needs to be setup before loading
517
+ pub fn is_init ( & self ) -> bool {
518
+ self . config . is_some ( )
519
+ }
520
+
512
521
/// Get the config, loading it if needed
513
522
///
514
523
/// On error, the process is terminated
You can’t perform that action at this time.
0 commit comments