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:
commit
9003e3fbe4
5 changed files with 389 additions and 29 deletions
21
tests/fixtures/nohup/is_atty.sh
vendored
Normal file
21
tests/fixtures/nohup/is_atty.sh
vendored
Normal 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
24
tests/fixtures/util/is_atty.sh
vendored
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue