1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 05:01:48 +02:00

Merge pull request #10573 from RCoeurjoly/Rename_SearchPath

Rename SearchPath to LookupPath and searchPath to lookupPath
This commit is contained in:
Robert Hensing 2024-04-21 17:33:46 +02:00 committed by GitHub
commit 6fd2f42c2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 133 additions and 139 deletions

View file

@ -80,14 +80,14 @@ 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).
*/
std::string runProgram(Path program, bool searchPath = false,
std::string runProgram(Path program, bool lookupPath = false,
const Strings & args = Strings(),
const std::optional<std::string> & input = {}, bool isInteractive = false);
struct RunOptions
{
Path program;
bool searchPath = true;
bool lookupPath = true;
Strings args;
#ifndef _WIN32
std::optional<uid_t> uid;

View file

@ -245,10 +245,10 @@ pid_t startProcess(std::function<void()> fun, const ProcessOptions & options)
}
std::string runProgram(Path program, bool searchPath, const Strings & args,
std::string runProgram(Path program, bool lookupPath, const Strings & args,
const std::optional<std::string> & input, bool isInteractive)
{
auto res = runProgram(RunOptions {.program = program, .searchPath = searchPath, .args = args, .input = input, .isInteractive = isInteractive});
auto res = runProgram(RunOptions {.program = program, .lookupPath = lookupPath, .args = args, .input = input, .isInteractive = isInteractive});
if (!statusOk(res.first))
throw ExecError(res.first, "program '%1%' %2%", program, statusToString(res.first));
@ -335,7 +335,7 @@ void runProgram2(const RunOptions & options)
restoreProcessContext();
if (options.searchPath)
if (options.lookupPath)
execvp(options.program.c_str(), stringsToCharPtrs(args_).data());
// This allows you to refer to a program with a pathname relative
// to the PATH variable.

View file

@ -28,7 +28,7 @@
namespace nix {
std::string runProgram(Path program, bool searchPath, const Strings & args,
std::string runProgram(Path program, bool lookupPath, const Strings & args,
const std::optional<std::string> & input, bool isInteractive)
{
throw UnimplementedError("Cannot shell out to git on Windows yet");