From 3e3def03ec7d4ac14360c8536a5e634edb182568 Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Mon, 27 Oct 2025 21:01:15 -0700 Subject: [PATCH] terminal init properly lexes init command --- bin/periphery/src/terminal.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/periphery/src/terminal.rs b/bin/periphery/src/terminal.rs index 6a2b83e75..445748e15 100644 --- a/bin/periphery/src/terminal.rs +++ b/bin/periphery/src/terminal.rs @@ -256,13 +256,15 @@ impl PeripheryTerminal { .openpty(PtySize::default()) .context("Failed to open terminal")?; - let mut command_split = command.split(' ').map(|arg| arg.trim()); - let cmd = - command_split.next().context("Command cannot be empty")?; + let mut lexed = shlex::split(&command) + .context("Invalid command: empty")? + .into_iter(); + + let cmd = lexed.next().context("Command cannot be empty")?; let mut cmd = CommandBuilder::new(cmd); - for arg in command_split { + for arg in lexed { cmd.arg(arg); }