Skip to content

Commit f484d35

Browse files
Avoid zsh taking over /dev/tty in self-test (#1557)
After running nix-installer self-test in a script on Darwin, if I then attempt to read from /dev/tty in the same script, it gets suspended by SIGTTIN. This seems to be a result of running zsh -ic which appears to take over /dev/tty via tcsetpgrp when doing job control stuff[1]. I can replicate the issue by running sh -c 'zsh -ic /usr/bin/true && read'. I haven't traced the exact codepaths, but the job control stuff only seems to kick in when zsh spawns and waits on a subprocess, so by execing the command, we seem to avoid the problem. This also avoids keeping the shell around longer than necessary so this seems like a win-win. [1] https://github.com/zsh-users/zsh/blob/87c055fb4d076c0d9bfffbef16ac8dd9348903df/Src/utils.c#L4779-L4781
1 parent be809ab commit f484d35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/self_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl Shell {
105105
.as_millis();
106106

107107
command.arg(format!(
108-
r#"nix build --option substitute false --option post-build-hook '' --no-link --expr 'derivation {{ name = "self-test-{executable}-{timestamp_millis}"; system = "{SYSTEM}"; builder = "/bin/sh"; args = ["-c" "echo hello > \$out"]; }}'"#
108+
r#"exec nix build --option substitute false --option post-build-hook '' --no-link --expr 'derivation {{ name = "self-test-{executable}-{timestamp_millis}"; system = "{SYSTEM}"; builder = "/bin/sh"; args = ["-c" "echo hello > \$out"]; }}'"#
109109
));
110110
let command_str = format!("{:?}", command.as_std());
111111

0 commit comments

Comments
 (0)