Skip to content

Commit 1630f4c

Browse files
scott2bclaude
andcommitted
Split EDITOR env var into binary and args before launching
EDITOR values like "code --wait" were passed as a single binary name to Command::new(), causing "No such file or directory". Now splits on whitespace so the binary and flags are handled correctly. Fixes #1 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 6b43361 commit 1630f4c

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

crates/muster-cli/src/commands/profile.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,23 @@ pub(crate) fn execute_edit(ctx: &CommandContext, id: &str) -> crate::error::Resu
204204
crate::error::CliError::User(format!("failed to write temp file: {e}"))
205205
})?;
206206

207-
let editor = std::env::var("EDITOR")
207+
let editor_raw = std::env::var("EDITOR")
208208
.or_else(|_| std::env::var("VISUAL"))
209209
.unwrap_or_else(|_| "vi".to_string());
210210

211-
let status = process::Command::new(&editor)
211+
// Split $EDITOR into binary + args (e.g. "code --wait" → ["code", "--wait"])
212+
let mut editor_parts = editor_raw.split_whitespace();
213+
let editor_bin = editor_parts.next().unwrap_or("vi");
214+
let editor_args: Vec<&str> = editor_parts.collect();
215+
216+
let status = process::Command::new(editor_bin)
217+
.args(&editor_args)
212218
.arg(tmp.path())
213219
.status()
214220
.map_err(|e| {
215-
crate::error::CliError::User(format!("failed to launch editor \"{editor}\": {e}"))
221+
crate::error::CliError::User(format!(
222+
"failed to launch editor \"{editor_bin}\": {e}"
223+
))
216224
})?;
217225

218226
if !status.success() {

0 commit comments

Comments
 (0)