mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
cmUVProcessChain::Wait(): Treat timeout of 0 as no timeout
This commit is contained in:
@@ -393,12 +393,12 @@ bool cmUVProcessChain::Valid() const
|
||||
return this->Data->Valid;
|
||||
}
|
||||
|
||||
bool cmUVProcessChain::Wait(int64_t milliseconds)
|
||||
bool cmUVProcessChain::Wait(uint64_t milliseconds)
|
||||
{
|
||||
bool timeout = false;
|
||||
cm::uv_timer_ptr timer;
|
||||
|
||||
if (milliseconds >= 0) {
|
||||
if (milliseconds > 0) {
|
||||
timer.init(*this->Data->Loop, &timeout);
|
||||
timer.start(
|
||||
[](uv_timer_t* handle) {
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
int ErrorStream();
|
||||
|
||||
bool Valid() const;
|
||||
bool Wait(int64_t milliseconds = -1);
|
||||
bool Wait(uint64_t milliseconds = 0);
|
||||
std::vector<const Status*> GetStatus() const;
|
||||
const Status& GetStatus(std::size_t index) const;
|
||||
bool Finished() const;
|
||||
|
||||
@@ -652,6 +652,20 @@ bool testUVProcessChainInputFile(const char* helperCommand)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool testUVProcessChainWait0(const char* helperCommand)
|
||||
{
|
||||
cmUVProcessChainBuilder builder;
|
||||
builder.AddCommand({ helperCommand, "echo" });
|
||||
|
||||
auto chain = builder.Start();
|
||||
if (!chain.Wait(0)) {
|
||||
std::cout << "Wait(0) returned false, should be true" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int testUVProcessChain(int argc, char** const argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
@@ -699,5 +713,10 @@ int testUVProcessChain(int argc, char** const argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!testUVProcessChainWait0(argv[1])) {
|
||||
std::cout << "While executing testUVProcessChainWait0().\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user