Skip to content

Commit 8e9526c

Browse files
committed
rust: resolve todo items in wrapper
1 parent 8dc417a commit 8e9526c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

rust/bear/src/bin/wrapper.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ fn next_in_path(target: &Path) -> Result<PathBuf> {
8585

8686
path.split(':')
8787
.map(|dir| Path::new(dir).join(target))
88-
// FIXME: check if it is executable
8988
.filter(|path| path.is_file())
9089
.find(|path| {
9190
// We need to compare it with the real path of the candidate executable to avoid
@@ -117,13 +116,10 @@ fn report(execution: Execution) -> Result<()> {
117116
}
118117

119118
fn into_execution(path_buf: &Path) -> Result<Execution> {
120-
std::env::current_dir()
121-
.with_context(|| "Cannot get current directory")
122-
.map(|working_dir| Execution {
123-
executable: path_buf.to_path_buf(),
124-
// FIXME: substitute the executable name on the first position
125-
arguments: std::env::args().collect(),
126-
working_dir,
127-
environment: std::env::vars().collect(),
128-
})
119+
Ok(Execution {
120+
executable: path_buf.to_path_buf(),
121+
arguments: std::env::args().collect(),
122+
working_dir: std::env::current_dir()?,
123+
environment: std::env::vars().collect(),
124+
})
129125
}

0 commit comments

Comments
 (0)