StackOverflow has an interesting question that involves failed output to stderr because of redirection to stdin. https://superuser.com/q/1620933/109090
In my answer I talk about how failed writes to stderr immediately terminate (crash) the cmd.exe process. Somewhere on DosTips I have some posts that discuss the behavior of cmd.exe when writes to stdout or stderr fail. I also have posts that talk about a limit to the size of messages that can be posted to stderr (or stdout). I think they are all in the same thread, but not sure. For the life of me, I cannot find these posts.
I'd be ever so grateful if someone could help me find them.
Thanks
Dave Benham
How does cmd.exe handle (or not handle) I/O errors?
Moderator: DosItHelp
Re: How does cmd.exe handle (or not handle) I/O errors?
Do you mean the following topic?
viewtopic.php?t=6881
Edit: You wrote on stackoverflow:
penpen
viewtopic.php?t=6881
Edit: You wrote on stackoverflow:
But at least under windows 10 you could get some error message:when writes to stdout fail, there is no error message or error returned what-so-ever!
Code: Select all
Z:\>echo 1>&0
Das System kann nicht auf das angegebene Gerät schreiben.
Z:\>echo 1>&0 2>nul
Z:\>
penpen
Re: How does cmd.exe handle (or not handle) I/O errors?
Wonderful. Thanks penpen. That is definitely one of them, but it is much earlier than I expected.
I'm pretty sure I have some more posts in a later thread (years later?) that revisit the subject. But the parent thread may not have been about I/O errors.
I think I was investigating some inner workings of cmd.exe and I saw output that didn't make any sense. Upon investigation I discovered that ECHO to stdout and/or error message routing to stderr limit the total length of the message. I think if the stderr message exceeded the buffer that it crashed, (or output was truncated?). This led me to revisit how cmd.exe handles I/O errors, and I did so in a more thorough fashion. Sigh - it's all hazy in my brain.
Dave Benham
I'm pretty sure I have some more posts in a later thread (years later?) that revisit the subject. But the parent thread may not have been about I/O errors.
I think I was investigating some inner workings of cmd.exe and I saw output that didn't make any sense. Upon investigation I discovered that ECHO to stdout and/or error message routing to stderr limit the total length of the message. I think if the stderr message exceeded the buffer that it crashed, (or output was truncated?). This led me to revisit how cmd.exe handles I/O errors, and I did so in a more thorough fashion. Sigh - it's all hazy in my brain.
Dave Benham