summaryrefslogtreecommitdiff
path: root/process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'process.cpp')
-rw-r--r--process.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/process.cpp b/process.cpp
index 6f1ec92..6adc417 100644
--- a/process.cpp
+++ b/process.cpp
@@ -131,7 +131,7 @@ void Process::unStop() {
if (pid != -1) kill(pid, SIGCONT);
}
-bool Process::writeLine(const string_view line) {
+bool Process::writeLine(const string_view line, bool allowBrokenPipe) {
if (pid == -1) return false;
string str;
@@ -144,7 +144,8 @@ bool Process::writeLine(const string_view line) {
ssize_t nw = write(infd, str.data() + cursor, str.size() - cursor);
if (nw < 0) {
if (errno == EINTR) continue;
- // perror("write");
+ if (allowBrokenPipe && errno == EPIPE) continue;
+ perror("write");
return false;
}
cursor += nw;