mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8289643: File descriptor leak with ProcessBuilder.startPipeline
Reviewed-by: alanb, jpai, lancea
This commit is contained in:
parent
7ec0132ad3
commit
620c8a045f
2 changed files with 144 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1296,6 +1296,10 @@ public final class ProcessBuilder
|
|||
redirects[1] = new RedirectPipeImpl(); // placeholder for new output
|
||||
}
|
||||
processes.add(builder.start(redirects));
|
||||
if (prevOutput instanceof RedirectPipeImpl redir) {
|
||||
// Wrap the fd so it can be closed
|
||||
new Process.PipeInputStream(redir.getFd()).close();
|
||||
}
|
||||
prevOutput = redirects[1];
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue