File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ pub mod process_group;
12
12
pub mod status_decoder;
13
13
14
14
use std:: borrow:: Cow ;
15
+ use std:: fs;
15
16
use std:: path:: Path ;
16
17
use std:: pin:: Pin ;
17
18
use std:: process:: Command ;
@@ -353,7 +354,20 @@ pub fn maybe_absolutize_exe<'a>(
353
354
354
355
let abs = spawned_process_cwd. join ( exe) ;
355
356
if fs_util:: try_exists ( & abs) . context ( "Error absolute-izing executable" ) ? {
356
- return Ok ( abs. into_path_buf ( ) . into ( ) ) ;
357
+ let metadata = fs:: metadata ( & abs) . context ( "Error getting metadata for path" ) ?;
358
+ if metadata. is_file ( ) {
359
+ #[ cfg( unix) ]
360
+ {
361
+ use std:: os:: unix:: fs:: PermissionsExt ;
362
+ if metadata. permissions ( ) . mode ( ) & 0o111 != 0 {
363
+ return Ok ( abs. into_path_buf ( ) . into ( ) ) ;
364
+ }
365
+ }
366
+ #[ cfg( not( unix) ) ]
367
+ {
368
+ return Ok ( abs. into_path_buf ( ) . into ( ) ) ;
369
+ }
370
+ }
357
371
}
358
372
359
373
Ok ( exe. into ( ) )
You can’t perform that action at this time.
0 commit comments