发出时grunt shell:test,我收到警告“输入设备不是TTY”并且不想使用-f:
grunt shell:test
-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.
这是Gruntfile.js命令:
Gruntfile.js
shell: { test: { command: './run.sh npm test' }
这里是run.sh:
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 $@
这是与package.json scriptswith 相关的命令test:
package.json
scripts
test
"scripts": { "test": "mocha --color=true -R spec test/*.test.js && npm run lint" }
如何grunt使dockerTTY满意?./run.sh npm test在咕unt声之外执行可以正常工作:
grunt
docker
./run.sh npm test
$ ./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
-t从docker run命令中删除:
-t
docker run $RUN_ENV_FILE -i --rm --user node -v "$PWD":/app -w /app yaktor/node:0.39.0 $@
该命令-t告诉docker配置tty,如果您没有tty并尝试将其附加到容器(如果不执行,则默认为-d),该配置将无效。
-d