Skip to content

Commit 28d7b20

Browse files
authored
Merge pull request #73547 from rintaro/macros-plugin-waitpid-rdar126489446
[Macros] Ensure reaping executable plugin process
2 parents db1c721 + 0a0e665 commit 28d7b20

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/AST/PluginRegistry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ LoadedExecutablePlugin::PluginProcess::~PluginProcess() {
172172
#if defined(_WIN32)
173173
_close(input);
174174
_close(output);
175-
CloseHandle(process.Process);
176175
#else
177176
close(input);
178177
close(output);
179178
#endif
179+
llvm::sys::Wait(process, /*SecondsToWait=*/0);
180180
}
181181

182182
LoadedExecutablePlugin::~LoadedExecutablePlugin() {

lib/Basic/Program.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ swift::ExecuteWithPipe(llvm::StringRef program,
187187
close(p2.write);
188188
llvm::sys::ProcessInfo proc;
189189
proc.Pid = pid;
190+
proc.Process = pid;
190191
return ChildProcessInfo(proc, p1.write, p2.read);
191192
}
192193

@@ -277,6 +278,7 @@ swift::ExecuteWithPipe(llvm::StringRef program,
277278
output[PI_READ].release();
278279

279280
llvm::sys::ProcessInfo proc;
281+
proc.Pid = pi.dwProcessId;
280282
proc.Process = pi.hProcess;
281283
return ChildProcessInfo(proc, ifd, ofd);
282284
}

0 commit comments

Comments
 (0)