aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkgs/populate/src/populate.rs4
-rw-r--r--tests/scenarios.nix13
2 files changed, 15 insertions, 2 deletions
diff --git a/pkgs/populate/src/populate.rs b/pkgs/populate/src/populate.rs
index 226cee2..40f86dd 100644
--- a/pkgs/populate/src/populate.rs
+++ b/pkgs/populate/src/populate.rs
@@ -114,9 +114,9 @@ fn deliver(
let file = fs::File::create(&out).map_err(|e| {
Failure::Message(format!("error: can't create {}: {e}", out.display()))
})?;
+ // Through a shell, which runs a command without #! as a script.
run::status(
- Command::new(string(settings, "command")?)
- .current_dir(&workdir)
+ run::local_shell("\"$1\"\n", &[string(settings, "command")?], &workdir)
.stdout(file),
)?;
run::status(
diff --git a/tests/scenarios.nix b/tests/scenarios.nix
index 15d0a53..362a854 100644
--- a/tests/scenarios.nix
+++ b/tests/scenarios.nix
@@ -1176,6 +1176,19 @@ assert !(krops.isLocalTarget (targets.remote "/"));
expect.fail = "error: flake /fixtures/top has no input nope";
}];
})
+ # A pipe command without #!, which a shell runs as a script.
+ (s "pipe-script" {
+ prepareDeployer = ''
+ printf 'echo piped\n' > /tmp/pipe-script
+ chmod +x /tmp/pipe-script
+ '';
+ phases = [{
+ sources.x.pipe = "/tmp/pipe-script";
+ check = ''
+ expect_eq x "$(cat "$T"/x)" piped
+ '';
+ }];
+ })
# An input locked to a path the target doesn't have.
(s "gone" {
phases = [{