Input/Output blocks post-action until keypress
See original GitHub issueI’ve been trying to leverage the Run Script PostAction with a custom script that lives in my template that gets turned into an executable script by a first PostAction.
However I’m running into a bit of an issue when trying to run interactive commands such as editor windows.
Essentially:
git commit -m "Initial Commit" -e
in the PostAction script will indefinitely block the dotnet new command until another key is pressed without the editor window being shown. Once a key is pressed the editor window shows up and works as expected. These pauses are a bit weird and might have to do with the handover to another application somehow, at the very least they make people wait a long time while the action has already taken place. I was about to file a bug report that it blocks indefinitely in general until I pressed a key and suddenly there was an editor window.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
The issue is indeed a bit different. The program I called from my script wrote some of its output to stderr, requesting the user to press enter to continue. This was not printed in the ongoing log. So the issue is actually that stderr is not being printed (or it is sometimes printed if the command does NOT succeed at the end). Otherwise its simply silently dropped.
A solution would be to not redirect stderr during the run or at least copy it to console as well when redirectStandardOutput is set to false.
Minimal example:
https://github.com/Blackclaws/dotnet-template-issue
@Blackclaws I’ve added additional configuration
redirectStandardError
in https://github.com/dotnet/templating/pull/3499 which allows to configure whether stream should be redirected or not, it will be available in next .NET 6 preview (RC 1)