summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-07-15 18:06:37 +0000
committerArne Juul <arnej@verizonmedia.com>2020-07-17 14:38:14 +0000
commit6f26d4daad46da0aa3ccae312da522d203a21585 (patch)
treed0bb08ec17ed6e37e0b8673fbbe11b53c65f6194 /vespalib
parented8fa0954399f92b38d6332ca48b24105e83b833 (diff)
rename SlaveProc -> ChildProc
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/CMakeLists.txt2
-rw-r--r--vespalib/src/tests/assert/assert_test.cpp8
-rw-r--r--vespalib/src/tests/child_proc/.gitignore4
-rw-r--r--vespalib/src/tests/child_proc/CMakeLists.txt8
-rw-r--r--vespalib/src/tests/child_proc/child_proc_test.cpp (renamed from vespalib/src/tests/slaveproc/slaveproc_test.cpp)36
-rw-r--r--vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp10
-rw-r--r--vespalib/src/tests/exception_classes/silenceuncaught_test.cpp16
-rw-r--r--vespalib/src/tests/host_name/host_name_test.cpp2
-rw-r--r--vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp4
-rw-r--r--vespalib/src/tests/slaveproc/.gitignore4
-rw-r--r--vespalib/src/tests/slaveproc/CMakeLists.txt8
-rw-r--r--vespalib/src/tests/tutorial/make_tutorial.cpp4
-rw-r--r--vespalib/src/vespa/vespalib/util/CMakeLists.txt2
-rw-r--r--vespalib/src/vespa/vespalib/util/child_proc.cpp (renamed from vespalib/src/vespa/vespalib/util/slaveproc.cpp)56
-rw-r--r--vespalib/src/vespa/vespalib/util/child_proc.h (renamed from vespalib/src/vespa/vespalib/util/slaveproc.h)18
15 files changed, 91 insertions, 91 deletions
diff --git a/vespalib/CMakeLists.txt b/vespalib/CMakeLists.txt
index 1ca9816a921..80c789ba379 100644
--- a/vespalib/CMakeLists.txt
+++ b/vespalib/CMakeLists.txt
@@ -97,7 +97,7 @@ vespa_define_module(
src/tests/sharedptr
src/tests/signalhandler
src/tests/simple_thread_bundle
- src/tests/slaveproc
+ src/tests/child_proc
src/tests/slime
src/tests/slime/external_data_value
src/tests/slime/summary-feature-benchmark
diff --git a/vespalib/src/tests/assert/assert_test.cpp b/vespalib/src/tests/assert/assert_test.cpp
index 860f56304ff..bdd9f5785dd 100644
--- a/vespalib/src/tests/assert/assert_test.cpp
+++ b/vespalib/src/tests/assert/assert_test.cpp
@@ -1,6 +1,6 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_proc.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/assert.h>
#include <vespa/vespalib/io/fileutil.h>
@@ -16,19 +16,19 @@ TEST("that it borks the first time.") {
vespalib::rmdir("var", true);
ASSERT_TRUE(vespalib::mkdir(assertDir, true));
{
- SlaveProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
+ ChildProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
proc.wait();
ASSERT_EQUAL(proc.getExitCode() & 0x7f, 6);
}
{
- SlaveProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
+ ChildProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
proc.readLine(assertName);
proc.wait();
ASSERT_EQUAL(proc.getExitCode() & 0x7f, 0);
}
ASSERT_EQUAL(0, unlink(assertName.c_str()));
{
- SlaveProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
+ ChildProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
proc.wait();
ASSERT_EQUAL(proc.getExitCode() & 0x7f, 6);
}
diff --git a/vespalib/src/tests/child_proc/.gitignore b/vespalib/src/tests/child_proc/.gitignore
new file mode 100644
index 00000000000..8b43b2b332e
--- /dev/null
+++ b/vespalib/src/tests/child_proc/.gitignore
@@ -0,0 +1,4 @@
+.depend
+Makefile
+child_proc_test
+vespalib_child_proc_test_app
diff --git a/vespalib/src/tests/child_proc/CMakeLists.txt b/vespalib/src/tests/child_proc/CMakeLists.txt
new file mode 100644
index 00000000000..45f0ae8f9a9
--- /dev/null
+++ b/vespalib/src/tests/child_proc/CMakeLists.txt
@@ -0,0 +1,8 @@
+# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+vespa_add_executable(vespalib_child_proc_test_app TEST
+ SOURCES
+ child_proc_test.cpp
+ DEPENDS
+ vespalib
+)
+vespa_add_test(NAME vespalib_child_proc_test_app COMMAND vespalib_child_proc_test_app)
diff --git a/vespalib/src/tests/slaveproc/slaveproc_test.cpp b/vespalib/src/tests/child_proc/child_proc_test.cpp
index 547da991211..d485ef75432 100644
--- a/vespalib/src/tests/slaveproc/slaveproc_test.cpp
+++ b/vespalib/src/tests/child_proc/child_proc_test.cpp
@@ -1,57 +1,57 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_proc.h>
-using vespalib::SlaveProc;
+using vespalib::ChildProc;
TEST("simple run, ignore output") {
- EXPECT_TRUE(SlaveProc::run("echo foo"));
+ EXPECT_TRUE(ChildProc::run("echo foo"));
}
TEST("simple run, ignore output, failure") {
- EXPECT_TRUE(!SlaveProc::run("false"));
+ EXPECT_TRUE(!ChildProc::run("false"));
}
TEST("simple run, ignore output, timeout") {
- EXPECT_TRUE(!SlaveProc::run("exec sleep 60", 10));
+ EXPECT_TRUE(!ChildProc::run("exec sleep 60", 10));
}
TEST("simple run") {
std::string out;
- EXPECT_TRUE(SlaveProc::run("/bin/echo -n foo", out));
+ EXPECT_TRUE(ChildProc::run("/bin/echo -n foo", out));
EXPECT_EQUAL(out, "foo");
}
TEST("simple run, strip single-line trailing newline") {
std::string out;
- EXPECT_TRUE(SlaveProc::run("echo foo", out));
+ EXPECT_TRUE(ChildProc::run("echo foo", out));
EXPECT_EQUAL(out, "foo");
}
TEST("simple run, don't strip multi-line output") {
std::string out;
- EXPECT_TRUE(SlaveProc::run("perl -e 'print \"foo\\n\\n\"'", out));
+ EXPECT_TRUE(ChildProc::run("perl -e 'print \"foo\\n\\n\"'", out));
EXPECT_EQUAL(out, "foo\n\n");
}
TEST("simple run with input") {
std::string in = "bar";
std::string out;
- EXPECT_TRUE(SlaveProc::run(in, "cat", out));
+ EXPECT_TRUE(ChildProc::run(in, "cat", out));
EXPECT_EQUAL(out, "bar");
}
TEST("simple run with input, strip single-line trailing newline") {
std::string in = "bar\n";
std::string out;
- EXPECT_TRUE(SlaveProc::run(in, "cat", out));
+ EXPECT_TRUE(ChildProc::run(in, "cat", out));
EXPECT_EQUAL(out, "bar");
}
TEST("simple run with input, don't strip multi-line output") {
std::string in = "bar\n\n";
std::string out;
- EXPECT_TRUE(SlaveProc::run(in, "cat", out));
+ EXPECT_TRUE(ChildProc::run(in, "cat", out));
EXPECT_EQUAL("bar\n\n", out);
}
@@ -64,11 +64,11 @@ TEST_MT("simple run, partial output due to timeout", 2) {
(thread_id == 0) ? "out" : "", timeout);
if (thread_id == 0) {
out.clear();
- EXPECT_TRUE(!SlaveProc::run(my_cmd, out, timeout));
+ EXPECT_TRUE(!ChildProc::run(my_cmd, out, timeout));
} else {
out.clear();
std::string in = "ignored\n";
- EXPECT_TRUE(!SlaveProc::run(in, my_cmd, out, timeout));
+ EXPECT_TRUE(!ChildProc::run(in, my_cmd, out, timeout));
}
if (out == "foo") {
break;
@@ -78,7 +78,7 @@ TEST_MT("simple run, partial output due to timeout", 2) {
}
TEST("proc failure") {
- SlaveProc proc("false");
+ ChildProc proc("false");
// read with length 0 will wait for output
EXPECT_TRUE(proc.read(NULL, 0) == 0);
EXPECT_TRUE(proc.wait(60000));
@@ -90,7 +90,7 @@ TEST("basic read/write") {
int x;
int read;
char buf[64];
- SlaveProc proc("cat");
+ ChildProc proc("cat");
EXPECT_TRUE(proc.running());
EXPECT_TRUE(!proc.failed());
@@ -117,7 +117,7 @@ TEST("basic read/write") {
TEST("continuos run, readLine") {
std::string str;
- SlaveProc proc("cat");
+ ChildProc proc("cat");
EXPECT_TRUE(proc.running());
EXPECT_TRUE(!proc.failed());
@@ -142,7 +142,7 @@ TEST("continuos run, readLine") {
TEST("readLine, eof flushes last line") {
std::string str;
- SlaveProc proc("cat");
+ ChildProc proc("cat");
EXPECT_TRUE(proc.running());
EXPECT_TRUE(!proc.failed());
@@ -166,7 +166,7 @@ TEST("readLine, eof flushes last line") {
TEST("long continuos run, readLine") {
std::string in;
std::string out;
- SlaveProc proc("cat");
+ ChildProc proc("cat");
EXPECT_TRUE(proc.running());
EXPECT_TRUE(!proc.failed());
diff --git a/vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp b/vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp
index 63defa58c41..17cb977631c 100644
--- a/vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp
+++ b/vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp
@@ -1,23 +1,23 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_proc.h>
-using vespalib::SlaveProc;
+using vespalib::ChildProc;
TEST("no arguments") {
- SlaveProc drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache");
+ ChildProc drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache");
drop.wait();
EXPECT_EQUAL(1, drop.getExitCode());
}
TEST("file does not exist") {
- SlaveProc drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache not_exist");
+ ChildProc drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache not_exist");
drop.wait();
EXPECT_EQUAL(2, drop.getExitCode());
}
TEST("All is well") {
- SlaveProc drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache vespalib_drop_file_from_cache_test_app");
+ ChildProc drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache vespalib_drop_file_from_cache_test_app");
drop.wait();
EXPECT_EQUAL(0, drop.getExitCode());
}
diff --git a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp
index 8d81d9e0821..7177a195fa3 100644
--- a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp
+++ b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/exception.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_proc.h>
using namespace vespalib;
@@ -14,32 +14,32 @@ using namespace vespalib;
#endif
TEST("that uncaught exception causes negative exitcode.") {
- SlaveProc proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught");
+ ChildProc proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught");
proc.wait();
EXPECT_LESS(proc.getExitCode(), 0);
}
TEST("that uncaught silenced exception causes exitcode 66") {
- SlaveProc proc("exec ./vespalib_caught_uncaught_app silenced_and_uncaught");
+ ChildProc proc("exec ./vespalib_caught_uncaught_app silenced_and_uncaught");
proc.wait();
EXPECT_EQUAL(proc.getExitCode(), 66);
}
TEST("that caught silenced exception followed by an uncaught causes negative exitcode.") {
- SlaveProc proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught_after_silenced_and_caught");
+ ChildProc proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught_after_silenced_and_caught");
proc.wait();
EXPECT_LESS(proc.getExitCode(), 0);
}
TEST("that caught silenced exception causes exitcode 0") {
- SlaveProc proc("exec ./vespalib_caught_uncaught_app silenced_and_caught");
+ ChildProc proc("exec ./vespalib_caught_uncaught_app silenced_and_caught");
proc.wait();
EXPECT_EQUAL(proc.getExitCode(), 0);
}
#ifndef __SANITIZE_ADDRESS__
TEST("that mmap within limits are fine cause exitcode 0") {
- SlaveProc proc("exec ./vespalib_mmap_app 150000000 10485760 1");
+ ChildProc proc("exec ./vespalib_mmap_app 150000000 10485760 1");
proc.wait();
EXPECT_EQUAL(proc.getExitCode(), 0);
}
@@ -48,13 +48,13 @@ TEST("that mmap within limits are fine cause exitcode 0") {
// setrlimit with RLIMIT_AS is broken on Darwin
#else
TEST("that mmap beyond limits cause negative exitcode.") {
- SlaveProc proc("ulimit -c 0 && exec ./vespalib_mmap_app 100000000 10485760 10");
+ ChildProc proc("ulimit -c 0 && exec ./vespalib_mmap_app 100000000 10485760 10");
proc.wait();
EXPECT_LESS(proc.getExitCode(), 0);
}
TEST("that mmap beyond limits with set VESPA_SILENCE_CORE_ON_OOM cause exitcode 66.") {
- SlaveProc proc("VESPA_SILENCE_CORE_ON_OOM=1 exec ./vespalib_mmap_app 100000000 10485760 10");
+ ChildProc proc("VESPA_SILENCE_CORE_ON_OOM=1 exec ./vespalib_mmap_app 100000000 10485760 10");
proc.wait();
EXPECT_EQUAL(proc.getExitCode(), 66);
}
diff --git a/vespalib/src/tests/host_name/host_name_test.cpp b/vespalib/src/tests/host_name/host_name_test.cpp
index 4e0c59d836d..21a8a571119 100644
--- a/vespalib/src/tests/host_name/host_name_test.cpp
+++ b/vespalib/src/tests/host_name/host_name_test.cpp
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/host_name.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_proc.h>
using namespace vespalib;
diff --git a/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp b/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp
index a7509014b00..8ae808839db 100644
--- a/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp
+++ b/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp
@@ -1,12 +1,12 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_proc.h>
using namespace vespalib;
bool runPrint(const char *cmd) {
std::string out;
- bool res = SlaveProc::run(cmd, out);
+ bool res = ChildProc::run(cmd, out);
fprintf(stderr, "%s", out.c_str());
return res;
}
diff --git a/vespalib/src/tests/slaveproc/.gitignore b/vespalib/src/tests/slaveproc/.gitignore
deleted file mode 100644
index 8851e99df13..00000000000
--- a/vespalib/src/tests/slaveproc/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.depend
-Makefile
-slaveproc_test
-vespalib_slaveproc_test_app
diff --git a/vespalib/src/tests/slaveproc/CMakeLists.txt b/vespalib/src/tests/slaveproc/CMakeLists.txt
deleted file mode 100644
index 58211d671bc..00000000000
--- a/vespalib/src/tests/slaveproc/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(vespalib_slaveproc_test_app TEST
- SOURCES
- slaveproc_test.cpp
- DEPENDS
- vespalib
-)
-vespa_add_test(NAME vespalib_slaveproc_test_app COMMAND vespalib_slaveproc_test_app)
diff --git a/vespalib/src/tests/tutorial/make_tutorial.cpp b/vespalib/src/tests/tutorial/make_tutorial.cpp
index 4890b0db62a..25398490318 100644
--- a/vespalib/src/tests/tutorial/make_tutorial.cpp
+++ b/vespalib/src/tests/tutorial/make_tutorial.cpp
@@ -1,6 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_proc.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -20,7 +20,7 @@ std::string readFile(const std::string &filename) {
std::string runCommand(const std::string &cmd) {
std::string out;
- ASSERT_TRUE(SlaveProc::run(cmd.c_str(), out));
+ ASSERT_TRUE(ChildProc::run(cmd.c_str(), out));
return out;
}
diff --git a/vespalib/src/vespa/vespalib/util/CMakeLists.txt b/vespalib/src/vespa/vespalib/util/CMakeLists.txt
index 4029c4881c4..65b6f508d72 100644
--- a/vespalib/src/vespa/vespalib/util/CMakeLists.txt
+++ b/vespalib/src/vespa/vespalib/util/CMakeLists.txt
@@ -46,7 +46,7 @@ vespa_add_library(vespalib_vespalib_util OBJECT
sig_catch.cpp
signalhandler.cpp
simple_thread_bundle.cpp
- slaveproc.cpp
+ child_proc.cpp
stash.cpp
string_hash.cpp
stringfmt.cpp
diff --git a/vespalib/src/vespa/vespalib/util/slaveproc.cpp b/vespalib/src/vespa/vespalib/util/child_proc.cpp
index 6f40aa9a4d7..37a0a905d27 100644
--- a/vespalib/src/vespa/vespalib/util/slaveproc.cpp
+++ b/vespalib/src/vespa/vespalib/util/child_proc.cpp
@@ -1,17 +1,17 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "guard.h"
-#include "slaveproc.h"
+#include "child_proc.h"
#include <cstring>
namespace vespalib {
-namespace slaveproc {
+namespace child_proc {
using namespace std::chrono;
/**
- * @brief SlaveProc internal timeout management.
+ * @brief ChildProc internal timeout management.
**/
class Timer
{
@@ -54,14 +54,14 @@ public:
}
};
-} // namespace slaveproc
+} // namespace child_proc
-using slaveproc::Timer;
+using child_proc::Timer;
//-----------------------------------------------------------------------------
void
-SlaveProc::Reader::OnReceiveData(const void *data, size_t length)
+ChildProc::Reader::OnReceiveData(const void *data, size_t length)
{
const char *buf = (const char *) data;
MonitorGuard lock(_cond);
@@ -80,7 +80,7 @@ SlaveProc::Reader::OnReceiveData(const void *data, size_t length)
bool
-SlaveProc::Reader::hasData()
+ChildProc::Reader::hasData()
{
// NB: caller has lock on _cond
return (!_data.empty() || !_queue.empty());
@@ -88,7 +88,7 @@ SlaveProc::Reader::hasData()
bool
-SlaveProc::Reader::waitForData(Timer &timer, MonitorGuard &lock)
+ChildProc::Reader::waitForData(Timer &timer, MonitorGuard &lock)
{
// NB: caller has lock on _cond
CounterGuard count(_waitCnt);
@@ -100,7 +100,7 @@ SlaveProc::Reader::waitForData(Timer &timer, MonitorGuard &lock)
void
-SlaveProc::Reader::updateEOF()
+ChildProc::Reader::updateEOF()
{
// NB: caller has lock on _cond
if (_data.empty() && _queue.empty() && _gotEOF) {
@@ -109,7 +109,7 @@ SlaveProc::Reader::updateEOF()
}
-SlaveProc::Reader::Reader()
+ChildProc::Reader::Reader()
: _cond(),
_queue(),
_data(),
@@ -120,13 +120,13 @@ SlaveProc::Reader::Reader()
}
-SlaveProc::Reader::~Reader()
+ChildProc::Reader::~Reader()
{
}
uint32_t
-SlaveProc::Reader::read(char *buf, uint32_t len, int msTimeout)
+ChildProc::Reader::read(char *buf, uint32_t len, int msTimeout)
{
if (eof()) {
return 0;
@@ -156,7 +156,7 @@ SlaveProc::Reader::read(char *buf, uint32_t len, int msTimeout)
bool
-SlaveProc::Reader::readLine(std::string &line, int msTimeout)
+ChildProc::Reader::readLine(std::string &line, int msTimeout)
{
line.clear();
if (eof()) {
@@ -193,7 +193,7 @@ SlaveProc::Reader::readLine(std::string &line, int msTimeout)
//-----------------------------------------------------------------------------
void
-SlaveProc::checkProc()
+ChildProc::checkProc()
{
if (_running) {
bool stillRunning;
@@ -205,7 +205,7 @@ SlaveProc::checkProc()
}
-SlaveProc::SlaveProc(const char *cmd)
+ChildProc::ChildProc(const char *cmd)
: _reader(),
_proc(cmd, true, &_reader),
_running(false),
@@ -217,11 +217,11 @@ SlaveProc::SlaveProc(const char *cmd)
}
-SlaveProc::~SlaveProc() = default;
+ChildProc::~ChildProc() = default;
bool
-SlaveProc::write(const char *buf, uint32_t len)
+ChildProc::write(const char *buf, uint32_t len)
{
if (len == 0) {
return true;
@@ -231,28 +231,28 @@ SlaveProc::write(const char *buf, uint32_t len)
bool
-SlaveProc::close()
+ChildProc::close()
{
return _proc.WriteStdin(nullptr, 0);
}
uint32_t
-SlaveProc::read(char *buf, uint32_t len, int msTimeout)
+ChildProc::read(char *buf, uint32_t len, int msTimeout)
{
return _reader.read(buf, len, msTimeout);
}
bool
-SlaveProc::readLine(std::string &line, int msTimeout)
+ChildProc::readLine(std::string &line, int msTimeout)
{
return _reader.readLine(line, msTimeout);
}
bool
-SlaveProc::wait(int msTimeout)
+ChildProc::wait(int msTimeout)
{
bool done = true;
checkProc();
@@ -273,7 +273,7 @@ SlaveProc::wait(int msTimeout)
bool
-SlaveProc::running()
+ChildProc::running()
{
checkProc();
return _running;
@@ -281,24 +281,24 @@ SlaveProc::running()
bool
-SlaveProc::failed()
+ChildProc::failed()
{
checkProc();
return _failed;
}
int
-SlaveProc::getExitCode()
+ChildProc::getExitCode()
{
return _exitCode;
}
bool
-SlaveProc::run(const std::string &input, const char *cmd,
+ChildProc::run(const std::string &input, const char *cmd,
std::string &output, int msTimeout)
{
- SlaveProc proc(cmd);
+ ChildProc proc(cmd);
Timer timer(msTimeout);
char buf[4096];
proc.write(input.data(), input.length());
@@ -317,7 +317,7 @@ SlaveProc::run(const std::string &input, const char *cmd,
bool
-SlaveProc::run(const char *cmd, std::string &output, int msTimeout)
+ChildProc::run(const char *cmd, std::string &output, int msTimeout)
{
std::string input; // empty input
return run(input, cmd, output, msTimeout);
@@ -325,7 +325,7 @@ SlaveProc::run(const char *cmd, std::string &output, int msTimeout)
bool
-SlaveProc::run(const char *cmd, int msTimeout)
+ChildProc::run(const char *cmd, int msTimeout)
{
std::string input; // empty input
std::string output; // ignore output
diff --git a/vespalib/src/vespa/vespalib/util/slaveproc.h b/vespalib/src/vespa/vespalib/util/child_proc.h
index c08a13f0b1d..16846dcb80a 100644
--- a/vespalib/src/vespa/vespalib/util/slaveproc.h
+++ b/vespalib/src/vespa/vespalib/util/child_proc.h
@@ -8,17 +8,17 @@
#include <queue>
#include "sync.h"
-namespace vespalib::slaveproc { class Timer; }
+namespace vespalib::child_proc { class Timer; }
namespace vespalib {
/**
- * @brief Slave Process utility class for running external programs
+ * @brief Child Process utility class for running external programs
*
* Designed for use in unit tests and other places
* where you need to run, control and communicate with
* some external program.
**/
-class SlaveProc
+class ChildProc
{
private:
class Reader : public FastOS_ProcessRedirectListener
@@ -33,7 +33,7 @@ private:
void OnReceiveData(const void *data, size_t length) override;
bool hasData();
- bool waitForData(slaveproc::Timer &timer, MonitorGuard &lock);
+ bool waitForData(child_proc::Timer &timer, MonitorGuard &lock);
void updateEOF();
public:
@@ -54,19 +54,19 @@ private:
void checkProc();
public:
- SlaveProc(const SlaveProc &) = delete;
- SlaveProc &operator=(const SlaveProc &) = delete;
+ ChildProc(const ChildProc &) = delete;
+ ChildProc &operator=(const ChildProc &) = delete;
/**
- * @brief Run a slave process
+ * @brief Run a child process
*
* Starts a process running the given command
* @param cmd A shell command line to run
**/
- explicit SlaveProc(const char *cmd);
+ explicit ChildProc(const char *cmd);
/** @brief destructor doing cleanup if needed */
- ~SlaveProc();
+ ~ChildProc();
/**
* @return process id