aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/unit_tests/process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit_tests/process.cpp')
-rw-r--r--test/unit_tests/process.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit_tests/process.cpp b/test/unit_tests/process.cpp
index 715364f..cfc50f4 100644
--- a/test/unit_tests/process.cpp
+++ b/test/unit_tests/process.cpp
@@ -15,6 +15,8 @@
#include <boost/test/unit_test.hpp>
+#include <chrono>
+#include <thread>
#include <utility>
using namespace winapi;
@@ -89,4 +91,19 @@ BOOST_FIXTURE_TEST_CASE(echo_runas, WithEchoExe) {
BOOST_TEST(process.get_exit_code() == 0);
}
+BOOST_FIXTURE_TEST_CASE(echo_terminate, WithEchoExe) {
+ const CommandLine cmd_line{get_echo_exe()};
+ const auto process = Process::create(cmd_line);
+
+ // echo.exe is stuck trying to read stdin.
+ BOOST_TEST(process.is_running());
+ std::this_thread::sleep_for(std::chrono::seconds{3});
+ BOOST_TEST(process.is_running());
+
+ process.shut_down(123);
+
+ BOOST_TEST(!process.is_running());
+ BOOST_TEST(process.get_exit_code() == 123);
+}
+
BOOST_AUTO_TEST_SUITE_END()