.NET: Detecting piped or file input to console but not user input?
logger.exe | app.exe //via pipe
app.exe < input.txt //via file
app.exe //no pipe or file input
In situation 1 or 2 when I read from STDIN, data is received. In situation
3 the app awaits input from the user, which I do not want. This app should
never receive data directly from a user.
How do I discern in code that situation 3 exists so that I can avoid
calling Console.ReadLine and thus have the application hang while it
awaits user input?
No comments:
Post a Comment