]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Test the new nohup behavior.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 23 Mar 2006 23:35:32 +0000 (23:35 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 23 Mar 2006 23:35:32 +0000 (23:35 +0000)
tests/misc/nohup

index 22054518911a6bd3cadc58d4b7aa900c148e1ca9..112811705fc6dc7bd293f292859128559a8b9412 100755 (executable)
@@ -28,20 +28,24 @@ fail=0
 nohup sh -c 'echo stdout; echo stderr 1>&2' 2>err || fail=1
 
 # Be careful.  The results of the above nohup command
-# change depending on whether stdout is redirected.
+# change depending on whether stdin and stdout are redirected.
 if test -t 1; then
   test "`cat nohup.out`" = stdout || fail=1
-  cat <<\EOF > exp || fail=1
-nohup: appending output to `nohup.out'
-stderr
-EOF
+  if test -t 0; then
+    echo 'nohup: ignoring input and appending output to `nohup.out'\'
+  else
+    echo 'nohup: appending output to `nohup.out'\'
+  fi >exp || fail=1
 else
   # Here it should not even exist.
   test -f nohup.out && fail=1
-  cat <<\EOF > exp || fail=1
-stderr
-EOF
+  if test -t 0; then
+    echo 'nohup: ignoring input' >exp
+  else
+    rm -f exp
+  fi || fail=1
 fi
+echo 'stderr' >> exp || fail=1
 
 cmp exp err || fail=1
 test $fail = 1 && diff exp err 2> /dev/null