fix: improve command execution in tests

This commit is contained in:
Andrew Phillips (aider)
2025-05-12 11:25:32 -03:00
parent 5b2d8b365d
commit 4c1fbdbd64

View File

@@ -53,10 +53,11 @@ mod tests {
// Save an item with some content
let input = "test content";
// Create a command that pipes input to keep with the specified environment
let cmd = format!("echo {} | {}", input, env);
let mut child = Command::new("sh")
.arg("-c")
.arg(format!("echo {} | {}", input, env))
.arg("cargo run -- --save"))
.arg(cmd)
.spawn()
.expect("Failed to spawn process");
@@ -83,10 +84,11 @@ mod tests {
// Save an item with some content
let input = "test content";
// Create a command that pipes input to keep with the specified environment
let cmd = format!("echo {} | {}", input, env);
let mut child = Command::new("sh")
.arg("-c")
.arg(format!("echo {} | {}", input, env))
.arg("cargo run -- --save"))
.arg(cmd)
.spawn()
.expect("Failed to spawn process");
@@ -112,10 +114,11 @@ mod tests {
// Save an item with some content
let input = "test content";
// Create a command that pipes input to keep with the specified environment
let cmd = format!("echo {} | {}", input, env);
let mut child = Command::new("sh")
.arg("-c")
.arg(format!("echo {} | {}", input, env))
.arg("cargo run -- --save"))
.arg(cmd)
.spawn()
.expect("Failed to spawn process");
@@ -141,10 +144,11 @@ mod tests {
// Save an item with some content
let input = "test content";
// Create a command that pipes input to keep with the specified environment
let cmd = format!("echo {} | {}", input, env);
let mut child = Command::new("sh")
.arg("-c")
.arg(format!("echo {} | {}", input, env))
.arg("cargo run -- --save"))
.arg(cmd)
.spawn()
.expect("Failed to spawn process");
@@ -186,10 +190,12 @@ mod tests {
// Save an item with some content and metadata
let input = "test content";
// Create a command that pipes input to keep with the specified environment and metadata
let cmd = format!("echo {} | {}", input, env);
let mut child = Command::new("sh")
.arg("-c")
.arg(format!("echo {} | {}", input, env))
.arg("cargo run -- --save --meta key=value"))
.arg(cmd)
.arg("cargo run -- --save --meta key=value")
.spawn()
.expect("Failed to spawn process");
@@ -224,10 +230,12 @@ mod tests {
// Save an item with some content and tags
let input = "test content";
// Create a command that pipes input to keep with the specified environment and tags
let cmd = format!("echo {} | {}", input, env);
let mut child = Command::new("sh")
.arg("-c")
.arg(format!("echo {} | {}", input, env))
.arg("cargo run -- --save --tag tag1 --tag tag2"))
.arg(cmd)
.arg("cargo run -- --save --tag tag1 --tag tag2")
.spawn()
.expect("Failed to spawn process");
@@ -253,10 +261,12 @@ mod tests {
// Save an item with some content and compression
let input = "test content";
// Create a command that pipes input to keep with the specified environment and compression
let cmd = format!("echo {} | {}", input, env);
let mut child = Command::new("sh")
.arg("-c")
.arg(format!("echo {} | {}", input, env))
.arg("cargo run -- --save --compression gzip"))
.arg(cmd)
.arg("cargo run -- --save --compression gzip")
.spawn()
.expect("Failed to spawn process");