@@ -54,6 +54,7 @@ class ProcessEpoll extends BaseEventProcessor<LinuxProcess>
54
54
this .process = process ;
55
55
56
56
registerProcess (process );
57
+ queueRead (process );
57
58
checkAndSetRunning ();
58
59
}
59
60
@@ -95,6 +96,32 @@ public void registerProcess(LinuxProcess process)
95
96
fildesToProcessMap .put (stdinFd , process );
96
97
fildesToProcessMap .put (stdoutFd , process );
97
98
fildesToProcessMap .put (stderrFd , process );
99
+ }
100
+ finally {
101
+ if (stdinFd != Integer .MIN_VALUE ) {
102
+ process .getStdin ().release ();
103
+ }
104
+ if (stdoutFd != Integer .MIN_VALUE ) {
105
+ process .getStdout ().release ();
106
+ }
107
+ if (stderrFd != Integer .MIN_VALUE ) {
108
+ process .getStderr ().release ();
109
+ }
110
+ }
111
+ }
112
+
113
+ @ Override
114
+ public void queueRead (LinuxProcess process )
115
+ {
116
+ if (shutdown ) {
117
+ return ;
118
+ }
119
+
120
+ int stdoutFd = Integer .MIN_VALUE ;
121
+ int stderrFd = Integer .MIN_VALUE ;
122
+ try {
123
+ stdoutFd = process .getStdout ().acquire ();
124
+ stderrFd = process .getStderr ().acquire ();
98
125
99
126
EpollEvent event = process .getEpollEvent ();
100
127
event .setEvents (LibEpoll .EPOLLIN );
@@ -114,9 +141,6 @@ public void registerProcess(LinuxProcess process)
114
141
}
115
142
}
116
143
finally {
117
- if (stdinFd != Integer .MIN_VALUE ) {
118
- process .getStdin ().release ();
119
- }
120
144
if (stdoutFd != Integer .MIN_VALUE ) {
121
145
process .getStdout ().release ();
122
146
}
0 commit comments