Closing stdout kills shell output

Project:JNode Shell
Component:Code
Category:bug report
Priority:minor
Assigned:Stephen Crawley
Status:closed
Description

If a command calls close() on stdout it prevents any output from the shell. You can see the commands you type, but no prompt and no out for any commands. Not a major issue, simple workaround is to make sure close is never called on stdout.

#1

Assigned to:Anonymous» Stephen Crawley

Hmmm ... I thought I explicitly guarded against this. Oh well.

#2

Status:active» fixed

I believe I have fixed this problem now, though it is difficult to be sure that I've found all of the ways it can happen. (My recollection in comment #1 was probably of an early version of the stream proxy code that I think never got committed.)

Marking as fixed.

#3

How to test? I'm having a similar problem and wonder how you would create a test for this. So far, it seems that two test commands are needed.

Let's say that stdoutclose-test is a very simple command. It does nothing other than close the given standard output stream. If everything is working, no problem. But if there is a problem, it is a big problem. A problem is not isolated.

Now, let's say that stdout-test is a separate command. It invokes stdoutclose-test with a new output stream. Is the output stream still open upon return? But this is not an actual test of the shell.

Any ideas are welcome,

#4

If I was to create a white box / regression test for this, I'd create a test command that obtained each of stdin/out/err as Input/OutputStream, Reader/Writer, PrintStream and PrintWriter (as appropriate) and tried to "close()" each of them. After each close it should then try another read / write.

#7

Status:fixed» closed

Manually closed