33

を発行するgrunt shell:testと、「入力デバイスは TTY ではありません」という警告が表示されます。使用する必要はありません-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コマンドは次のとおりです。

shell: {
  test: {
    command: './run.sh npm test'
  }

ここにあり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 scriptsするコマンドは次のtestとおりです。

"scripts": {
  "test": "mocha --color=true -R spec test/*.test.js && npm run lint"
}

TTY で満足するgruntにはどうすればよいですか? dockergrunt の外で実行./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
4

2 に答える 2

72

-tdocker run コマンドから を削除します。

docker run $RUN_ENV_FILE -i --rm --user node -v "$PWD":/app -w /app yaktor/node:0.39.0 $@

-t、docker に tty を構成するように指示します。これは、tty がなく、コンテナーに接続しようとすると機能しません (実行しない場合のデフォルト-d)。

于 2016-11-10T20:59:09.643 に答える