有没有一种方法可以让用户与“grunt shell”(或其他任务,如"grunt-exec")调用的内部命令进行交互?我有这样一个配置:
grunt.initConfig({
shell: {
bower_install: {
command: 'bower install'
}
}
});问题是,有时脚本需要与用户交互(例如,bower提示您选择包版本),但当我运行我的"grunt shell“任务时,在通常bower会要求用户选择之后,grunt任务失败。
解决办法可能是使用bower依赖,这样它就不会要求选择,但这不是解决方案。我可以让grunt shell命令像从shell中正常调用一样工作吗?
感谢您的回复。
发布于 2015-03-27 22:10:15
grunt-shell 1.1.2可以通过stdin与用户交互。下面的grunt任务使用wget通过ftp下载一个目录,并提示我输入密码:
shell: {
target: {
command: 'wget --ftp-user=some-user --ask-password ftp://some-ftp/directory/*'
}
}https://stackoverflow.com/questions/23672557
复制相似问题