Skip to content

Commit 0376696

Browse files
committed
escape executable path, fix bug with new line syntax
1 parent 629675f commit 0376696

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

crates/bridge/src/launcher.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ impl Launcher {
5050
.collect(),
5151
)
5252
}
53+
54+
fn filter_params<F>(self, f: F) -> Self
55+
where
56+
F: Fn(&String) -> bool,
57+
{
58+
Self(self.0, self.1.into_iter().filter(|s| f(s)).collect())
59+
}
5360
}
5461

5562
const DEFAULT_TERMINALS: [(&str, &str, &str); 5] = [
@@ -417,7 +424,7 @@ pub fn run(
417424
let launcher = if let Some(line) = line {
418425
launcher.apply_var(VAR_LINE, &format!("+{line}"))
419426
} else {
420-
launcher
427+
launcher.filter_params(|s| s != VAR_LINE)
421428
};
422429

423430
let launcher = launcher.apply_var(VAR_FILE, file_str);

crates/core/assets/run_linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env bash
2-
{BRIDGE_PATH} {DEBUG_FLAG} launch-neovim {LAUNCH_PRE_ARGS} "$(realpath .)" "$1" $2 {LAUNCH_POST_ARGS}
2+
"{BRIDGE_PATH}" {DEBUG_FLAG} launch-neovim {LAUNCH_PRE_ARGS} "$(realpath .)" "$1" $2 {LAUNCH_POST_ARGS}

crates/core/assets/run_macos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22
export PATH="/usr/bin:/usr/local/bin:$PATH"
3-
{BRIDGE_PATH} {DEBUG_FLAG} launch-neovim {LAUNCH_PRE_ARGS} "$(realpath .)" "$1" $2 {LAUNCH_POST_ARGS}
3+
"{BRIDGE_PATH}" {DEBUG_FLAG} launch-neovim {LAUNCH_PRE_ARGS} "$(realpath .)" "$1" $2 {LAUNCH_POST_ARGS}

crates/core/assets/run_windows.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
@echo off
2-
{BRIDGE_PATH} {DEBUG_FLAG} launch-neovim {LAUNCH_PRE_ARGS} "%CD%" "%~1" %2 {LAUNCH_POST_ARGS}
2+
"{BRIDGE_PATH}" {DEBUG_FLAG} launch-neovim {LAUNCH_PRE_ARGS} "%CD%" "%~1" %2 {LAUNCH_POST_ARGS}

0 commit comments

Comments
 (0)