Commit 5d2513b8 authored by Julia Beliaeva's avatar Julia Beliaeva Committed by Maxim.Mossienko
Browse files

[git] do not close process input after writing hashes to it

Closing input will prevent soft-killing the process.

IDEA-177754, EA-113449, IDEA-183399

(cherry picked from commit 2eb78562)
parent bb24b186
Showing with 8 additions and 6 deletions
+8 -6
......@@ -393,14 +393,16 @@ public class GitLogUtil {
public static void sendHashesToStdin(@NotNull GitVcs vcs, @NotNull Collection<String> hashes, @NotNull GitHandler handler) {
String separator = getSeparator(vcs);
handler.setInputProcessor(stream -> {
try (OutputStreamWriter writer = new OutputStreamWriter(stream, handler.getCharset())) {
for (String hash : hashes) {
writer.write(hash);
writer.write(separator);
}
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
OutputStreamWriter writer = new OutputStreamWriter(stream, handler.getCharset());
// if we close this stream, RunnerMediator won't be able to send ctrl+c to the process in order to softly kill it
// see RunnerMediator.sendCtrlEventThroughStream
for (String hash : hashes) {
writer.write(hash);
writer.write(separator);
writer.flush();
}
writer.write(separator);
writer.flush();
});
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment