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)
33
35
. with_context ( || "could not change to requested directory" ) ?;
@@ -510,6 +512,13 @@ impl LazyConfig {
510
512
Self { config : None }
511
513
}
512
514
515
+ /// Check whether the config is loaded
516
+ ///
517
+ /// This is useful for asserts in case the environment needs to be setup before loading
518
+ pub fn is_init ( & self ) -> bool {
519
+ self . config . is_some ( )
520
+ }
521
+
513
522
/// Get the config, loading it if needed
514
523
///
515
524
/// On error, the process is terminated
You can’t perform that action at this time.
0 commit comments