标签: grunt-shell

当使用grunt-shell调用调用docker run的脚本时,如何解决"输入设备不是TTY"?

发布时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.
Run Code Online (Sandbox Code Playgroud)

这是Gruntfile.js命令:

shell: {
  test: {
    command: './run.sh npm test'
  }
Run Code Online (Sandbox Code Playgroud)

这是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 …
Run Code Online (Sandbox Code Playgroud)

tty gruntjs docker grunt-shell

27
推荐指数
2
解决办法
2万
查看次数

ctrl-c [SIGINT]在使用grunt-shell时不使用Grunt

如果我使用Grunt Task Runner和grunt-shell,我无法使用ctrl-c [SIGINT]退出grunt.

grunt.registerTask('serve', [
  'less',
  'autoprefixer',
  'shell:hologram', // grunt-shell task
  'connect:livereload',
  'watch'
]);
Run Code Online (Sandbox Code Playgroud)

以下是shell的配置方式:

grunt.initConfig({

...

  shell: {
    options: {
      failOnError: false
    },
    hologram: {
      command: 'bundle exec hologram'
    },
  },

...

}
Run Code Online (Sandbox Code Playgroud)

gruntjs grunt-contrib-watch grunt-shell

7
推荐指数
1
解决办法
393
查看次数

Grunt-shell将命令输出作为变量

我正在使用Grunt和Grunt-shell来构建/部署我的Javascript项目.

我想得到最新的git-commit编号并将其存储为变量,但无法弄清楚如何.我尝试过回调并设置全局变量.此变量可在函数内使用,但不能在其他块中使用

grunt.initConfig({
...
shell: {
      getGitCommitNo: {
        command: 'git rev-parse --short HEAD',
        options: {
          callback: function (err, stdout, stderr, cb) {
              global['gitCommitNo'] = stdout;
              grunt.log.ok(global.gitCommitNo);
              cb();
            }
        }
      },
      philTest: {
         command: 'echo Git Commit No: ' +  global.gitCommitNo
      },
...
}
Run Code Online (Sandbox Code Playgroud)

输出:

>> Starting deployment process for version 1.1 in dev environment

Running "shell:getGitCommitNo" (shell) task
bfc82a9
>> bfc82a9

Running "shell:printTest" (shell) task
Git Commit No: undefined

Done, without errors.
Run Code Online (Sandbox Code Playgroud)

任何人都可以建议我如何将命令行的输出保存到可用的变量吗?

git gruntjs grunt-shell

6
推荐指数
1
解决办法
1012
查看次数

标签 统计

grunt-shell ×3

gruntjs ×3

docker ×1

git ×1

grunt-contrib-watch ×1

tty ×1