When issuing grunt shell:test
, I'm getting warning "the input device is not a TTY" & don't want to have to use -f
:
$ grunt shell:test
Running "shell:test" (shell) task
the input device is not a TTY
Warning: Command failed: /bin/sh -c ./run.sh npm test
the input device is not a TTY
Use --force to continue.
Aborted due to warnings.
Here's the Gruntfile.js
command:
shell: {
test: {
command: './run.sh npm test'
}
Here's run.sh
:
#!/bin/sh
# should use the latest available image to validate, but not LATEST
if [ -f .env ]; then
RUN_ENV_FILE='--env-file .env'
fi
docker run $RUN_ENV_FILE -it --rm --user node -v "$PWD":/app -w /app yaktor/node:0.39.0 $@
Here's the relevant package.json
scripts
with command test
:
"scripts": {
"test": "mocha --color=true -R spec test/*.test.js && npm run lint"
}
How can I get grunt
to make docker
happy with a TTY? Executing ./run.sh npm test
outside of grunt works fine:
$ ./run.sh npm test
> yaktor@0.59.2-pre.0 test /app
> mocha --color=true -R spec test/*.test.js && npm run lint
[snip]
105 passing (3s)
> yaktor@0.59.2-pre.0 lint /app
> standard --verbose
This solved an annoying issue for me. The script had these lines:
The script would run great if run directly and the mail would come with the correct output. However, when run from
cron
, (crontab -e
) the mail would come with no content. Tried many things around permissions and shells and paths etc. However no joy!Finally found this:
And on that
cron.log
file found this output:Search led me here. And after I removed the
-t
, it's working great now!Remove the
-t
from the docker run command:The
-t
tells docker to configure the tty, which won't work if you don't have a tty and try to attach to the container (default when you don't do a-d
).