forked from facebookarchive/nailgun
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow java classes to close stdout/stderr
When the client calls a class, where either stdout or stderr is closed the socket connection to the client is closed and no further data is sent. This includes data transmitted over the other stream and exit codes.
- Loading branch information
Showing
2 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71981b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when methods are called on a closed OutputStream? Should NGOutputStream set a flag in close() and override the other OutputStream methods to emulate the closed OutputStream behaviour when the flag is set?
71981b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I am don't know. Basically in C if someone closes the stdout fd, it cannot write anymore to it.
From http://docs.oracle.com/javase/6/docs/api/java/io/OutputStream.html#close()
I am not sure, but does this means any subsequent writes to the stream will throw an exception, and writing to the stream?
71981b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, a quick test shows a an IOException:
having this:
Results into this:
Will add a "close" flag and throw an exception if set, and will see what happens.
71981b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, check this one: 2785ce9 (in branch for-issue23).