File tree 1 file changed +2
-30
lines changed
1 file changed +2
-30
lines changed Original file line number Diff line number Diff line change @@ -123,41 +123,13 @@ pub fn resolve_executable(exec: &Path) -> Result<PathBuf> {
123
123
} ) ;
124
124
for candidate in candidates {
125
125
if candidate. is_file ( ) {
126
- // PATH may have a component like "." in it, so we still need to
127
- // canonicalize.
128
- // Only do so if there are relative path components
129
- let has_relative_path_components = candidate. components ( ) . any ( |c| {
130
- matches ! (
131
- c,
132
- std:: path:: Component :: ParentDir | std:: path:: Component :: CurDir
133
- )
134
- } ) ;
135
- return Ok ( if has_relative_path_components {
136
- // Assure symlinks to programs like 'echo' don't change the file-name after resolution.
137
- // root program like 'coreutils' which relies on the executable name for proper function.
138
- let file_name = candidate
139
- . file_name ( )
140
- . expect ( "executables have a file name" )
141
- . to_owned ( ) ;
142
- let candidate = candidate
143
- . canonicalize ( ) ?
144
- . parent ( )
145
- . expect ( "a parent is always available for tools called in test-suite" )
146
- . join ( file_name)
147
- . to_owned ( ) ;
148
- if !candidate. is_file ( ) {
149
- continue ;
150
- }
151
- candidate
152
- } else {
153
- candidate
154
- } ) ;
126
+ return Ok ( candidate) ;
155
127
}
156
128
}
157
129
158
130
anyhow:: bail!( "no executable for `{}` found in PATH" , exec. display( ) )
159
131
} else {
160
- Ok ( exec. canonicalize ( ) ? )
132
+ Ok ( exec. into ( ) )
161
133
}
162
134
}
163
135
You can’t perform that action at this time.
0 commit comments