From 3f24a417dacd5a5964f781f4d704a5253401d380 Mon Sep 17 00:00:00 2001
From: Sebastian Ullrich <sebasti@nullri.ch>
Date: Mon, 9 Nov 2020 17:57:39 +0100
Subject: [PATCH] Add test case for incidentally fixed #4228

---
 tests/nix-shell.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/nix-shell.sh b/tests/nix-shell.sh
index 3b000a049..7b2be650a 100644
--- a/tests/nix-shell.sh
+++ b/tests/nix-shell.sh
@@ -58,9 +58,13 @@ output=$($TEST_ROOT/shell.shebang.rb abc ruby)
 
 # Test 'nix develop'.
 nix develop -f shell.nix shellDrv -c bash -c '[[ -n $stdenv ]]'
-# Preserve stdin with `-c`
+
+# Ensure `nix develop -c` preserves stdin
 echo foo | nix develop -f shell.nix shellDrv -c cat | grep -q foo
 
+# Ensure `nix develop -c` actually executes the command if stdout isn't a terminal
+nix develop -f shell.nix shellDrv -c echo foo |& grep -q foo
+
 # Test 'nix print-dev-env'.
 source <(nix print-dev-env -f shell.nix shellDrv)
 [[ -n $stdenv ]]