Your unit test script probably calls
tput in order to generate pretty output showing which tests pass and fail. Under
cron there is no terminal and thus no terminal type (
tput cannot control the nonexistent terminal.
Your unit test script needs to have 2 modes:
- running on a terminal: it can call
tput to generate pretty-looking output
- not running on a terminal: it should not call
tput and instead generate a generic text-only output format that is suitable for piping into an email as you are doing here.
The easiest way for the unit tests to know whether or not they are running on a terminal is to test of the stdio file descritors refer to a terminal. If it's a shell script, then:
if [ -t 1 ]; then
tput bold; echo pretty; tput sgr0
Basically: do not call
tput unless you are running on a terminal, and you will thus avoid the error you are getting, plus produce reasonable output in whichever mode you happen to be running under.