Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions shell/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,11 +904,13 @@ fn parse_line_inner(
}
'"' if state.last_ch != '\\' => {
let arg_str = read_string(jobs, chars)?;
let resolved = arg_str.resolve_arg(jobs)?.to_string_lossy().to_string();
// Single quote in token to avoid future expansions in string.
// Escape any literal single quotes in the content with '\'' so
// they survive the downstream expansion pipeline (expand_braces,
// expand_params_comms, expand_globs, strip_quotes).
state.token().push('\'');
state
.token()
.push_str(&arg_str.resolve_arg(jobs)?.to_string_lossy());
state.token().push_str(&resolved.replace('\'', "'\\''"));
state.token().push('\'');
state.last_ch = ch;
}
Expand Down
1 change: 1 addition & 0 deletions slosh_lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ pub fn run_slosh(modify_vm: impl FnOnce(&mut SloshVm)) -> i32 {
status = run_shell_with_stdin();
}
} else if let Some(mut command) = config.command {
load_core_slosh();
for a in &config.args {
command.push(' ');
command.push_str(a);
Expand Down