Git-command stuck
Jpunt opened this issue · 8 comments
My shell gets stuck when running this command, but only sometimes:
commitVersion: {
command: "git commit -am 'Release version <%= new_version %>' && git tag <%= new_version %> && git push && git push --tags",
},
new_version
comes from task from grunt-prompt. The weird thing is, the commands are actually executed (i've got a new commit with that message, a new tag, and everything is pushed), but my shell doesn't get the callback:
Running "prompt:release" (prompt) task
? Current version is 1.0.13, what version do you wanna release? 1.0.14
Running "replace:version" (replace) task
Running "shell:commitVersion" (shell) task
What can I try to fix this?
Same here.
Our Command executes git flow feature start "feature_name"
and gets stuck although everything is done correctly.
Any fix?
@Jpunt After a quick test i suggest you to use grunt-exec in the meantime until this is fixed.
It works for us and the commands are the same.
Also had a command getting stuck: ncu -u
which is npm-check-updates.
Nevermind me, my issue seems with the module itself - raineorshine/npm-check-updates#119
Nope, it's a grunt-shell issue. Also npm install
breaks. This could be the reason: raineorshine/npm-check-updates#119
I think the issue with ncu
boils down to process.stdin.isTTY being undefined
in processes spawned by exec
, making is-stdin
think there i something on stdin when there is not. grunt-shell
's attempt to pipe stdin (process.stdin.pipe(cp.stdin)
) to the child is fruitless because the exec command already has run by the point this pipe is attached.
I think the proper solution here would be to switch to spawn
and define stdio stream handling inside the spawn
options. Either that, or it's a node bug with isTTY
(though undefined
vs false
doesn't change much for this bug).
Closing as it seems it's a Node.js core problem and nothing we can do here.
I think this should be fixed in this module or maybe a wrapper by calling stdin.end()
on the ChildProcess. Any child process that waits on stdin will hang until stdin is explicitely closed:
https://nodejs.org/api/child_process.html#child_process_child_stdin