Skip to content
Snippets Groups Projects
Commit 7d3cf544 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

Add timeout functionality to waitfor() helper functions.

Otherwise, a stuck child process could potentially hang the test, and thus the
whole viewer build.
parent cf6aabff
No related branches found
No related tags found
No related merge requests found
......@@ -101,20 +101,26 @@ void yield(int seconds=1)
LLEventPumps::instance().obtain("mainloop").post(LLSD());
}
void waitfor(LLProcess& proc)
void waitfor(LLProcess& proc, int timeout=60)
{
while (proc.isRunning())
int i = 0;
for ( ; i < timeout && proc.isRunning(); ++i)
{
yield();
}
tut::ensure(STRINGIZE("process took longer than " << timeout << " seconds to terminate"),
i < timeout);
}
void waitfor(LLProcess::handle h, const std::string& desc)
void waitfor(LLProcess::handle h, const std::string& desc, int timeout=60)
{
while (LLProcess::isRunning(h, desc))
int i = 0;
for ( ; i < timeout && LLProcess::isRunning(h, desc); ++i)
{
yield();
}
tut::ensure(STRINGIZE("process took longer than " << timeout << " seconds to terminate"),
i < timeout);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment