File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,13 +183,15 @@ fn get_preload_env(_tmp_dir: &TempDir) -> UResult<(String, PathBuf)> {
183183 // Search paths in order:
184184 // 1. Directory where stdbuf is located (program_path)
185185 // 2. Compile-time directory from LIBSTDBUF_DIR
186- let mut search_paths: Vec < PathBuf > = Vec :: new ( ) ;
186+ let mut search_paths: Vec < PathBuf > = Vec :: with_capacity ( 2 ) ;
187187
188188 // First, try to get the directory where stdbuf is running from
189- if let Ok ( exe_path) = std:: env:: current_exe ( ) {
190- if let Some ( exe_dir) = exe_path. parent ( ) {
191- search_paths. push ( exe_dir. to_path_buf ( ) ) ;
192- }
189+ // use argv[0] to support masked /proc
190+ if let Some ( exe_dir) = std:: env:: args_os ( )
191+ . next ( )
192+ . and_then ( |a| PathBuf :: from ( a) . parent ( ) . map ( std:: path:: Path :: to_path_buf) )
193+ {
194+ search_paths. push ( exe_dir) ;
193195 }
194196
195197 // Add the compile-time directory as fallback
You can’t perform that action at this time.
0 commit comments