Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User prompts do not work with redirected stdin #1291

Closed
Haydabase opened this issue Dec 4, 2015 · 1 comment
Closed

User prompts do not work with redirected stdin #1291

Haydabase opened this issue Dec 4, 2015 · 1 comment

Comments

@Haydabase
Copy link
Contributor

We have multiple repositories all using NuGet for package management, and there are a number of steps I currently need to take in each to convert them to using Paket, beyond just calling convert-from-nuget.
I am trying to write a script which does all this for me, and calls into paket.exe for convert-from-nuget and simplify, redirecting the standard input/output so my script can make decisions about what to remove. But am having trouble when the executable prompts about deleting files:

Paket failed with:
Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.

This seems to be due to using Console.ReadKey() which according to the documentation cannot read from redirected standard input. I am proposing changing this to use Console.ReadLine(), which can read from standard input. The consequence of this, is that users would have to hit y/n followed by enter, rather than just y/n.

Thoughts?

@forki
Copy link
Member

forki commented Dec 4, 2015

I don't think that would be an issue.

Haydabase added a commit to Haydabase/Paket that referenced this issue Dec 4, 2015
The prompt is now implemented with Console.ReadLine() which works with
redirected standard input
Haydabase added a commit to Haydabase/Paket that referenced this issue Dec 5, 2015
readKey was no longer an appropriate name since it now reads a whole
line
@forki forki closed this as completed Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants