File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use clap::{Arg, Command};
88use std:: env;
99use std:: io;
1010use std:: path:: PathBuf ;
11+ use std:: sync:: LazyLock ;
1112use uucore:: format_usage;
1213
1314use uucore:: display:: println_verbatim;
@@ -115,7 +116,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
115116 // We should get c in this case instead of a/b at the end of the path
116117 let cwd = if matches. get_flag ( OPT_PHYSICAL ) {
117118 physical_path ( )
118- } else if matches. get_flag ( OPT_LOGICAL ) || env :: var ( "POSIXLY_CORRECT" ) . is_ok ( ) {
119+ } else if matches. get_flag ( OPT_LOGICAL ) || * IS_POSIXLY_CORRECT {
119120 logical_path ( )
120121 } else {
121122 physical_path ( )
@@ -161,3 +162,6 @@ pub fn uu_app() -> Command {
161162 . action ( ArgAction :: SetTrue ) ,
162163 )
163164}
165+
166+ static IS_POSIXLY_CORRECT : LazyLock < bool > =
167+ LazyLock :: new ( || env:: var_os ( "POSIXLY_CORRECT" ) . is_some ( ) ) ;
You can’t perform that action at this time.
0 commit comments