1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

Merge pull request #5869 from cre4ture/feature/simulate_terminal_utility

test utilities: easy way to simulate terminal context
This commit is contained in:
Sylvestre Ledru 2024-03-01 18:13:27 +01:00 committed by GitHub
commit 9003e3fbe4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 389 additions and 29 deletions

21
tests/fixtures/nohup/is_atty.sh vendored Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash
if [ -t 0 ] ; then
echo "stdin is atty"
else
echo "stdin is not atty"
fi
if [ -t 1 ] ; then
echo "stdout is atty"
else
echo "stdout is not atty"
fi
if [ -t 2 ] ; then
echo "stderr is atty"
else
echo "stderr is not atty"
fi
true

24
tests/fixtures/util/is_atty.sh vendored Normal file
View file

@ -0,0 +1,24 @@
#!/bin/bash
if [ -t 0 ] ; then
echo "stdin is atty"
else
echo "stdin is not atty"
fi
if [ -t 1 ] ; then
echo "stdout is atty"
else
echo "stdout is not atty"
fi
if [ -t 2 ] ; then
echo "stderr is atty"
echo "terminal size: $(stty size)"
else
echo "stderr is not atty"
fi
>&2 echo "This is an error message."
true