Skip to content

Commit 657df3b

Browse files
committed
Fix missing copy operations (delete them)
This removes the copy operations from the piped_process class since we do not want to implement these. Also fix unit tests that used these.
1 parent f592858 commit 657df3b

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/util/piped_process.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ class piped_processt
7878
/// \param commandvec The command and arguments to create the process
7979
explicit piped_processt(const std::vector<std::string> commandvec);
8080

81+
// Deleted due to declaring an explicit destructor and not wanting copy
82+
// constructors to be implemented.
83+
piped_processt(const piped_processt &) = delete;
84+
piped_processt &operator=(const piped_processt &) = delete;
8185
~piped_processt();
8286

8387
protected:

unit/util/piped_process.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ TEST_CASE(
2020
commands.push_back("/bin/echo");
2121
commands.push_back(to_be_echoed);
2222
#endif
23-
piped_processt process = piped_processt(commands);
23+
piped_processt process(commands);
2424

2525
// This is an indirect way to detect when the pipe has something. This
2626
// could (in theory) also return when there is an error, but this unit
@@ -43,7 +43,7 @@ TEST_CASE(
4343
const std::string expected_error("Launching abcde failed");
4444
commands.push_back("abcde");
4545
#endif
46-
piped_processt process = piped_processt(commands);
46+
piped_processt process(commands);
4747

4848
// This is an indirect way to detect when the pipe has something. This
4949
// could (in theory) also return when there is an error, but this unit
@@ -78,7 +78,7 @@ TEST_CASE(
7878
SYSTEMTIME st;
7979
GetSystemTime(&st);
8080
WORD calc = 3600 * st.wHour + 60 * st.wMinute + st.wSecond;
81-
piped_processt process = piped_processt(commands);
81+
piped_processt process(commands);
8282
process.~piped_processt();
8383
GetSystemTime(&st);
8484
// New time minus old time, could go wrong at midnight
@@ -87,7 +87,7 @@ TEST_CASE(
8787
// Currently not working under Linxu/MacOS?!
8888
// commands.push_back("sleep 6");
8989
// time_t calc = time(NULL);
90-
// piped_processt process = piped_processt(commands);
90+
// piped_processt process(commands);
9191
// process.~piped_processt();
9292
// calc = time(NULL) - calc;
9393
size_t calc = 0;
@@ -106,7 +106,7 @@ TEST_CASE(
106106
std::vector<std::string> commands;
107107
commands.push_back("z3");
108108
commands.push_back("-in");
109-
piped_processt process = piped_processt(commands);
109+
piped_processt process(commands);
110110

111111
REQUIRE(
112112
process.send("(echo \"hi\")\n") ==
@@ -128,7 +128,7 @@ TEST_CASE(
128128
commands.push_back("z3");
129129
commands.push_back("-in");
130130
const std::string termination_statement = "(exit)\n";
131-
piped_processt process = piped_processt(commands);
131+
piped_processt process(commands);
132132

133133
REQUIRE(
134134
process.send("(echo \"hi\")\n") ==
@@ -158,7 +158,7 @@ TEST_CASE(
158158
commands.push_back("z3");
159159
commands.push_back("-in");
160160
commands.push_back("-smt2");
161-
piped_processt process = piped_processt(commands);
161+
piped_processt process(commands);
162162

163163
std::string message =
164164
"(set-logic QF_LIA) (declare-const x Int) (declare-const y Int) (assert (> "
@@ -182,7 +182,7 @@ TEST_CASE(
182182
commands.push_back("z3");
183183
commands.push_back("-in");
184184
commands.push_back("-smt2");
185-
piped_processt process = piped_processt(commands);
185+
piped_processt process(commands);
186186

187187
std::string statement =
188188
"(set-logic QF_LIA) (declare-const x Int) (declare-const y Int) (assert (> "
@@ -204,7 +204,7 @@ TEST_CASE(
204204
std::vector<std::string> commands;
205205
commands.push_back("z3");
206206
commands.push_back("-in");
207-
piped_processt process = piped_processt(commands);
207+
piped_processt process(commands);
208208

209209
REQUIRE(
210210
process.send("(echo \"hi\")\n") ==
@@ -234,7 +234,7 @@ TEST_CASE(
234234
commands.push_back("z3");
235235
commands.push_back("-in");
236236
commands.push_back("-smt2");
237-
piped_processt process = piped_processt(commands);
237+
piped_processt process(commands);
238238

239239
std::string statement =
240240
"(set-logic QF_LIA) (declare-const x Int) (declare-const y Int) (assert (> "
@@ -290,7 +290,7 @@ TEST_CASE(
290290
commands.push_back("z3");
291291
commands.push_back("-in");
292292
commands.push_back("-smt2");
293-
piped_processt process = piped_processt(commands);
293+
piped_processt process(commands);
294294

295295
std::string statement =
296296
"(set-logic QF_LIA) (declare-const x Int) (declare-const y Int) (assert (> "

0 commit comments

Comments
 (0)