Skip to content

Commit 32dce8c

Browse files
authored
Merge pull request #78 from WagnerPMC/master
Fixing work of the WAIT_COMMAND environment variable
2 parents 48b2683 + f9ea0b8 commit 32dce8c

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ pub fn parse_command<S: Into<String>>(
141141
if command_string.is_empty() {
142142
return Ok(None);
143143
}
144-
let argv = shell_words::split(&command_string)?;
144+
let mut argv = shell_words::split(&command_string)?;
145145
Ok(Some((
146146
Command {
147-
program: argv[0].clone(),
147+
program: argv.remove(0),
148148
argv,
149149
},
150150
command_string,
@@ -308,15 +308,15 @@ mod test {
308308
let (command, command_string) = parse_command("ls".to_string()).unwrap().unwrap();
309309
assert_eq!("ls", command_string);
310310
assert_eq!("ls", command.program);
311-
assert_eq!(vec!["ls"], command.argv);
311+
assert_eq!(Vec::<String>::new(), command.argv);
312312
}
313313

314314
#[test]
315315
fn parse_command_handles_commands_with_args() {
316316
let (command, command_string) = parse_command("ls -al".to_string()).unwrap().unwrap();
317317
assert_eq!("ls -al", command_string);
318318
assert_eq!("ls", command.program);
319-
assert_eq!(vec!["ls", "-al"], command.argv);
319+
assert_eq!(vec!["-al"], command.argv);
320320
}
321321

322322
#[test]
@@ -326,7 +326,7 @@ mod test {
326326
.unwrap();
327327
assert_eq!("hello world", command_string);
328328
assert_eq!("hello", command.program);
329-
assert_eq!(vec!["hello", "world"], command.argv);
329+
assert_eq!(vec!["world"], command.argv);
330330
}
331331

332332
#[test]
@@ -337,9 +337,6 @@ mod test {
337337
.unwrap();
338338
assert_eq!("find . -type \"f\" -name '*.rs'", command_string);
339339
assert_eq!("find", command.program);
340-
assert_eq!(
341-
vec!["find", ".", "-type", "f", "-name", "*.rs"],
342-
command.argv
343-
);
340+
assert_eq!(vec![".", "-type", "f", "-name", "*.rs"], command.argv);
344341
}
345342
}

0 commit comments

Comments
 (0)