mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-10 00:59:28 -06:00
cmUVProcessChain: Build stdout before stderr
This is more intuitive in the case of merged streams.
This commit is contained in:
@@ -219,6 +219,38 @@ bool cmUVProcessChain::InternalData::Prepare(
|
||||
break;
|
||||
}
|
||||
|
||||
auto const& output =
|
||||
this->Builder->Stdio[cmUVProcessChainBuilder::Stream_OUTPUT];
|
||||
auto& outputData = this->OutputStreamData;
|
||||
switch (output.Type) {
|
||||
case cmUVProcessChainBuilder::None:
|
||||
outputData.Stdio.flags = UV_IGNORE;
|
||||
break;
|
||||
|
||||
case cmUVProcessChainBuilder::Builtin: {
|
||||
int pipeFd[2];
|
||||
if (cmGetPipes(pipeFd) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
outputData.BuiltinStream = pipeFd[0];
|
||||
outputData.Stdio.flags = UV_INHERIT_FD;
|
||||
outputData.Stdio.data.fd = pipeFd[1];
|
||||
|
||||
if (this->TempOutputPipe.init(*this->Loop, 0) < 0) {
|
||||
return false;
|
||||
}
|
||||
if (uv_pipe_open(this->TempOutputPipe, outputData.Stdio.data.fd) < 0) {
|
||||
return false;
|
||||
}
|
||||
} break;
|
||||
|
||||
case cmUVProcessChainBuilder::External:
|
||||
outputData.Stdio.flags = UV_INHERIT_FD;
|
||||
outputData.Stdio.data.fd = output.FileDescriptor;
|
||||
break;
|
||||
}
|
||||
|
||||
auto const& error =
|
||||
this->Builder->Stdio[cmUVProcessChainBuilder::Stream_ERROR];
|
||||
auto& errorData = this->ErrorStreamData;
|
||||
@@ -228,66 +260,33 @@ bool cmUVProcessChain::InternalData::Prepare(
|
||||
break;
|
||||
|
||||
case cmUVProcessChainBuilder::Builtin: {
|
||||
int pipeFd[2];
|
||||
if (cmGetPipes(pipeFd) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
errorData.BuiltinStream = pipeFd[0];
|
||||
errorData.Stdio.flags = UV_INHERIT_FD;
|
||||
errorData.Stdio.data.fd = pipeFd[1];
|
||||
|
||||
if (this->TempErrorPipe.init(*this->Loop, 0) < 0) {
|
||||
return false;
|
||||
}
|
||||
if (uv_pipe_open(this->TempErrorPipe, errorData.Stdio.data.fd) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case cmUVProcessChainBuilder::External:
|
||||
errorData.Stdio.flags = UV_INHERIT_FD;
|
||||
errorData.Stdio.data.fd = error.FileDescriptor;
|
||||
break;
|
||||
}
|
||||
|
||||
auto const& output =
|
||||
this->Builder->Stdio[cmUVProcessChainBuilder::Stream_OUTPUT];
|
||||
auto& outputData = this->OutputStreamData;
|
||||
switch (output.Type) {
|
||||
case cmUVProcessChainBuilder::None:
|
||||
outputData.Stdio.flags = UV_IGNORE;
|
||||
break;
|
||||
|
||||
case cmUVProcessChainBuilder::Builtin:
|
||||
if (this->Builder->MergedBuiltinStreams) {
|
||||
outputData.BuiltinStream = errorData.BuiltinStream;
|
||||
outputData.Stdio.flags = UV_INHERIT_FD;
|
||||
outputData.Stdio.data.fd = errorData.Stdio.data.fd;
|
||||
errorData.BuiltinStream = outputData.BuiltinStream;
|
||||
errorData.Stdio.flags = UV_INHERIT_FD;
|
||||
errorData.Stdio.data.fd = outputData.Stdio.data.fd;
|
||||
} else {
|
||||
int pipeFd[2];
|
||||
if (cmGetPipes(pipeFd) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
outputData.BuiltinStream = pipeFd[0];
|
||||
outputData.Stdio.flags = UV_INHERIT_FD;
|
||||
outputData.Stdio.data.fd = pipeFd[1];
|
||||
errorData.BuiltinStream = pipeFd[0];
|
||||
errorData.Stdio.flags = UV_INHERIT_FD;
|
||||
errorData.Stdio.data.fd = pipeFd[1];
|
||||
|
||||
if (this->TempOutputPipe.init(*this->Loop, 0) < 0) {
|
||||
if (this->TempErrorPipe.init(*this->Loop, 0) < 0) {
|
||||
return false;
|
||||
}
|
||||
if (uv_pipe_open(this->TempOutputPipe, outputData.Stdio.data.fd) < 0) {
|
||||
if (uv_pipe_open(this->TempErrorPipe, errorData.Stdio.data.fd) < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case cmUVProcessChainBuilder::External:
|
||||
outputData.Stdio.flags = UV_INHERIT_FD;
|
||||
outputData.Stdio.data.fd = output.FileDescriptor;
|
||||
errorData.Stdio.flags = UV_INHERIT_FD;
|
||||
errorData.Stdio.data.fd = error.FileDescriptor;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user