aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorNick Van den Broeck <nick.van.den.broeck666@gmail.com>2019-03-21 09:30:16 +0100
committerNick Van den Broeck <nick.van.den.broeck666@gmail.com>2019-04-17 13:31:09 +0200
commitb42ba08fc8a291c549c1f9f92457d72639fac995 (patch)
tree8d630e5f9bbd84322d08e8b33c56afd345c6e2da /src/libutil
parent939bee06cd7c68af1508fab127202689fc63c22e (diff)
Add command `flake clone`
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/util.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index b0a2b853e..f4f86c5c8 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -962,12 +962,14 @@ std::vector<char *> stringsToCharPtrs(const Strings & ss)
return res;
}
-
+// Output = "standard out" output stream
string runProgram(Path program, bool searchPath, const Strings & args,
const std::optional<std::string> & input)
{
RunOptions opts(program, args);
opts.searchPath = searchPath;
+ // This allows you to refer to a program with a pathname relative to the
+ // PATH variable.
opts.input = input;
auto res = runProgram(opts);
@@ -978,6 +980,7 @@ string runProgram(Path program, bool searchPath, const Strings & args,
return res.second;
}
+// Output = error code + "standard out" output stream
std::pair<int, std::string> runProgram(const RunOptions & options_)
{
RunOptions options(options_);
@@ -1028,6 +1031,8 @@ void runProgram2(const RunOptions & options)
if (options.searchPath)
execvp(options.program.c_str(), stringsToCharPtrs(args_).data());
+ // This allows you to refer to a program with a pathname relative
+ // to the PATH variable.
else
execv(options.program.c_str(), stringsToCharPtrs(args_).data());