about summary refs log tree commit diff
path: root/src/libutil/util.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-03-15T13·40+0100
committerEelco Dolstra <edolstra@gmail.com>2017-03-15T15·50+0100
commit25dff2b7dbab54bd97b5ec22a05e594504555a12 (patch)
tree5847593a4cd246899ef09a47fd44b0c872c5fe6e /src/libutil/util.hh
parent042975ea8e2e081c0d44190c8b41104131f8c6d4 (diff)
runProgram(): Distinguish between empty input and no input
For example, if we call brotli with an empty input, it shouldn't read
from the caller's stdin.
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r--src/libutil/util.hh4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index b74c1d41739a..4e3a011b349c 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -14,6 +14,7 @@
 #include <cstdio>
 #include <map>
 #include <sstream>
+#include <experimental/optional>
 
 #ifndef HAVE_STRUCT_DIRENT_D_TYPE
 #define DT_UNKNOWN 0
@@ -232,7 +233,8 @@ pid_t startProcess(std::function<void()> fun, const ProcessOptions & options = P
 /* Run a program and return its stdout in a string (i.e., like the
    shell backtick operator). */
 string runProgram(Path program, bool searchPath = false,
-    const Strings & args = Strings(), const string & input = "");
+    const Strings & args = Strings(),
+    const std::experimental::optional<std::string> & input = {});
 
 class ExecError : public Error
 {