Skip to content

Commit 4019ae6

Browse files
committed
Fixup first commit
1 parent 5eb6a96 commit 4019ae6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/util/piped_process.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,23 @@
2121

2222
# include "exception_utils.h"
2323
# include "invariant.h"
24+
# include "message.h"
2425
# include "narrow.h"
2526
# include "optional.h"
2627
# include "piped_process.h"
2728
# include "string_utils.h"
2829

2930
# define BUFSIZE 2048
3031

31-
piped_processt::piped_processt(const std::vector<std::string> commandvec)
32+
piped_processt::piped_processt(const std::vector<std::string> commandvec,
33+
message_handlert& message_handler)
3234
{
3335
# ifdef _WIN32
3436
UNIMPLEMENTED_FEATURE("Pipe IPC on windows.")
3537
# else
3638

39+
messaget log(message_handler);
40+
3741
if(pipe(pipe_input) == -1)
3842
{
3943
throw system_exceptiont("Input pipe creation failed");
@@ -92,8 +96,8 @@ piped_processt::piped_processt(const std::vector<std::string> commandvec)
9296
}
9397
free(args);
9498
// Only reachable if execvp failed
95-
std::cerr << "Launching " << commandvec[0]
96-
<< " failed with error: " << std::strerror(errno) << std::endl;
99+
log.error() << "Launching " << commandvec[0]
100+
<< " failed with error: " << std::strerror(errno);
97101
abort();
98102
}
99103
else

src/util/piped_process.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# include <vector>
1313

1414
# include "optional.h"
15+
# include "message.h"
1516

1617
# define PIPED_PROCESS_INFINITE_TIMEOUT \
1718
optionalt<std::size_t> \
@@ -76,7 +77,7 @@ class piped_processt
7677
/// Initiate a new subprocess with pipes supporting communication
7778
/// between the parent (this process) and the child.
7879
/// \param commandvec The command and arguments to create the process
79-
explicit piped_processt(const std::vector<std::string> commandvec);
80+
explicit piped_processt(const std::vector<std::string> commandvec, message_handlert&);
8081

8182
~piped_processt();
8283

0 commit comments

Comments
 (0)