Fix launch manager://localhost not parsing distant.args properly

pull/184/head
Chip Senkbeil 1 year ago
parent c989a851ce
commit bbf74f1e71
No known key found for this signature in database
GPG Key ID: 35EF1F8EC72A4131

@ -91,11 +91,30 @@ impl LaunchHandler for ManagerLaunchHandler {
// Add any options arguments to the command
if let Some(options_args) = config.distant.args {
let mut distant_args = options_args.as_str();
// Detect if our args are wrapped in quotes, and strip the outer quotes
loop {
if let Some(args) = distant_args
.strip_prefix('"')
.and_then(|s| s.strip_suffix('"'))
{
distant_args = args;
} else if let Some(args) = distant_args
.strip_prefix('\'')
.and_then(|s| s.strip_suffix('\''))
{
distant_args = args;
} else {
break;
}
}
// NOTE: Split arguments based on whether we are running on windows or unix
args.extend(if cfg!(windows) {
winsplit::split(&options_args)
winsplit::split(distant_args)
} else {
shell_words::split(&options_args)
shell_words::split(distant_args)
.map_err(|x| io::Error::new(io::ErrorKind::InvalidInput, x))?
});
}

Loading…
Cancel
Save