mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
Bug 345164 - Spawner leaks pipes
This commit is contained in:
parent
790ba0fc84
commit
371fea8238
1 changed files with 23 additions and 18 deletions
|
@ -202,15 +202,21 @@ public class Spawner extends Process {
|
||||||
while (!isDone) {
|
while (!isDone) {
|
||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
try {
|
// Close the streams on this side.
|
||||||
if(null == err)
|
// If the stream was never used
|
||||||
getErrorStream().close();
|
// we still want to create it, so that we can close
|
||||||
if(null == in)
|
// the pipe on the other side.
|
||||||
getInputStream().close();
|
//
|
||||||
if(null == out)
|
// Technically, we shouldn't close the streams here but
|
||||||
getOutputStream().close();
|
// should rely on destroy() being called properly.
|
||||||
} catch (IOException e) {
|
// However, since we did close the streams here, we
|
||||||
}
|
// cannot remove this code or we would break anyone who
|
||||||
|
// does not call destroy() properly and relies on this
|
||||||
|
// code instead.
|
||||||
|
// Bug 345164
|
||||||
|
try { getErrorStream().close(); } catch (IOException e) {}
|
||||||
|
try { getInputStream().close(); } catch (IOException e) {}
|
||||||
|
try { getOutputStream().close();} catch (IOException e) {}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,15 +239,14 @@ public class Spawner extends Process {
|
||||||
// Sends the TERM
|
// Sends the TERM
|
||||||
terminate();
|
terminate();
|
||||||
// Close the streams on this side.
|
// Close the streams on this side.
|
||||||
try {
|
// If the stream was never used
|
||||||
if(null == err)
|
// we still want to create it, so that we can close
|
||||||
getErrorStream().close();
|
// the pipe on the other side.
|
||||||
if(null == in)
|
// Bug 345164
|
||||||
getInputStream().close();
|
try { getErrorStream().close(); } catch (IOException e) {}
|
||||||
if(null == out)
|
try { getInputStream().close(); } catch (IOException e) {}
|
||||||
getOutputStream().close();
|
try { getOutputStream().close();} catch (IOException e) {}
|
||||||
} catch (IOException e) {
|
|
||||||
}
|
|
||||||
// Grace before using the heavy gone.
|
// Grace before using the heavy gone.
|
||||||
if (!isDone) {
|
if (!isDone) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue