Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Never close STDIN, STDOUT and STDERR (i.e. only close when fd > 2) Sh…
Browse files Browse the repository at this point in the history
…ould solve eventmachine#183
  • Loading branch information
Vishnu Gopal committed Aug 24, 2011
1 parent 46e3bc2 commit 95da7f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ext/ed.cpp
Expand Up @@ -168,10 +168,13 @@ void EventableDescriptor::Close()
* Therefore, it is necessary to notify EventMachine that
* the fd associated with this EventableDescriptor is
* closing.
*
* EventMachine also never closes fds for STDIN, STDOUT and
* STDERR (0, 1 & 2)
*/

// Close the socket right now. Intended for emergencies.
if (MySocket != INVALID_SOCKET && !bWatchOnly) {
if (MySocket != INVALID_SOCKET && MySocket > 2 && !bWatchOnly) {
MyEventMachine->Closing (this);
shutdown (MySocket, 1);
close (MySocket);
Expand Down

0 comments on commit 95da7f3

Please sign in to comment.