【发布时间】:2014-05-15 08:06:46
【问题描述】:
有没有办法让用户与“grunt-shell”(或“grunt-exec”等其他任务)调用的内部命令进行交互? 我有这样的配置:
grunt.initConfig({
shell: {
bower_install: {
command: 'bower install'
}
}
});
问题是有时脚本需要与用户交互(例如,bower 提示您选择软件包版本)但是当我运行我的“grunt shell”任务时,在通常 bower 会要求用户选择的点之后,grunt 任务失败。
解决方法可能是使用 bower 依赖项,这样它就不会要求选择,但不是解决方案。我可以让 grunt-shell 命令像通常从 shell 调用一样工作吗?
感谢回复。
【问题讨论】:
-
您关于 bower 的具体问题可能与
read在 grunt-shell 中使用时似乎没有回显输出的原因相同:仅当从终端发出命令时才会显示提示.见stackoverflow.com/questions/27807982/…。这只是一个猜测。
标签: shell gruntjs bower grunt-shell