mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 12:16:40 +08:00
cmUVProcessChain: Tolerate fileno() of invalid FILE stream
On Windows, in a GUI process without a console, the `std{in,out,err}` standard FILE streams may not be open. Avoid passing an invalid file descriptor to the child process, and let libuv attach NUL instead. Fixes: #25625
This commit is contained in:
@@ -122,7 +122,11 @@ cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetExternalStream(
|
||||
cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetExternalStream(
|
||||
Stream stdio, FILE* stream)
|
||||
{
|
||||
return this->SetExternalStream(stdio, cm_fileno(stream));
|
||||
int fd = cm_fileno(stream);
|
||||
if (fd >= 0) {
|
||||
return this->SetExternalStream(stdio, fd);
|
||||
}
|
||||
return this->SetNoStream(stdio);
|
||||
}
|
||||
|
||||
cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetMergedBuiltinStreams()
|
||||
|
Reference in New Issue
Block a user