Skip to content

Commit

Permalink
fix: variable in quoted string (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
prsabahrami authored Sep 30, 2024
1 parent aa5a6ae commit 90d3346
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/deno_task_shell/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ fn parse_quoted_word(pair: Pair<Rule>) -> Result<WordPart> {
parts.push(WordPart::Command(command));
}
Rule::VARIABLE => {
parts.push(WordPart::Variable(part.as_str()[1..].to_string()))
parts.push(WordPart::Variable(part.as_str().to_string()))
}
Rule::QUOTED_CHAR => {
if let Some(WordPart::Text(ref mut s)) = parts.last_mut() {
Expand Down
6 changes: 6 additions & 0 deletions crates/tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ async fn commands() {
.run()
.await;

TestBuilder::new()
.command(r#"FOO=1; echo "$FOO""#)
.assert_stdout("1\n")
.run()
.await;

TestBuilder::new()
.command("echo 'a/b'/c")
.assert_stdout("a/b/c\n")
Expand Down

0 comments on commit 90d3346

Please sign in to comment.