From 8cb48bafe60fa0f28a83d676944d6fb9fb0187f7 Mon Sep 17 00:00:00 2001
From: prsabahrami
Date: Sun, 29 Sep 2024 17:53:00 -0400
Subject: [PATCH 1/2] Fix variable in quoted string
---
crates/deno_task_shell/src/parser.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crates/deno_task_shell/src/parser.rs b/crates/deno_task_shell/src/parser.rs
index c438ece..2745ca0 100644
--- a/crates/deno_task_shell/src/parser.rs
+++ b/crates/deno_task_shell/src/parser.rs
@@ -1507,7 +1507,7 @@ fn parse_quoted_word(pair: Pair) -> Result {
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() {
From 2e373d1e2c30f1eb268e3cb02141fdbcce5b6e92 Mon Sep 17 00:00:00 2001
From: prsabahrami
Date: Mon, 30 Sep 2024 00:05:18 -0400
Subject: [PATCH 2/2] Added test
---
crates/tests/src/lib.rs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/crates/tests/src/lib.rs b/crates/tests/src/lib.rs
index 65c5ea7..45ab92e 100644
--- a/crates/tests/src/lib.rs
+++ b/crates/tests/src/lib.rs
@@ -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")