summaryrefslogtreecommitdiffhomepage
path: root/tests/webserverprocess.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/webserverprocess.cpp')
-rw-r--r--tests/webserverprocess.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/webserverprocess.cpp b/tests/webserverprocess.cpp
index f9ecdd3..31c9766 100644
--- a/tests/webserverprocess.cpp
+++ b/tests/webserverprocess.cpp
@@ -109,12 +109,14 @@ VZTqPHmb+db0rFA3XlAg2A==
start();
}
-WebserverProcess::WebserverProcess(const std::string& config): m_pid{}
+WebserverProcess::WebserverProcess(const std::string& config, bool wait_for_listener):
+ m_pid{}, m_wait_for_listener{wait_for_listener}
{
init(config);
}
-WebserverProcess::WebserverProcess(): m_pid{}
+WebserverProcess::WebserverProcess(bool wait_for_listener):
+ m_pid{}, m_wait_for_listener{wait_for_listener}
{
std::string config{R"CONFIG(<webserver>
<user>www-data</user>
@@ -190,10 +192,12 @@ void WebserverProcess::start()
webserver(sizeof(argv) / sizeof(char*), argv);
exit(0);
}
-
- // wait for server to start up
- if (int port{port_from_config(m_config)}; port >= 0)
- Process::wait_for_pid_listening_on(m_pid, port);
+
+ if (m_wait_for_listener) {
+ // wait for server to start up
+ if (int port{port_from_config(m_config)}; port >= 0)
+ Process::wait_for_pid_listening_on(m_pid, port);
+ }
std::this_thread::sleep_for(std::chrono::milliseconds(20));
}