mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
Add nix::execvpe
This commit is contained in:
parent
31f3f23ee6
commit
c4192a6617
3 changed files with 21 additions and 0 deletions
13
src/libutil/unix/exec.hh
Normal file
13
src/libutil/unix/exec.hh
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace nix {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `execvpe` is a GNU extension, so we need to implement it for other POSIX
|
||||||
|
* platforms.
|
||||||
|
*
|
||||||
|
* We use our own implementation unconditionally for consistency.
|
||||||
|
*/
|
||||||
|
int execvpe(const char * file0, char * const argv[], char * const envp[]);
|
||||||
|
|
||||||
|
}
|
|
@ -13,6 +13,7 @@ sources += files(
|
||||||
include_dirs += include_directories('.')
|
include_dirs += include_directories('.')
|
||||||
|
|
||||||
headers += files(
|
headers += files(
|
||||||
|
'exec.hh',
|
||||||
'monitor-fd.hh',
|
'monitor-fd.hh',
|
||||||
'signals-impl.hh',
|
'signals-impl.hh',
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "current-process.hh"
|
#include "current-process.hh"
|
||||||
#include "environment-variables.hh"
|
#include "environment-variables.hh"
|
||||||
|
#include "executable-path.hh"
|
||||||
#include "signals.hh"
|
#include "signals.hh"
|
||||||
#include "processes.hh"
|
#include "processes.hh"
|
||||||
#include "finally.hh"
|
#include "finally.hh"
|
||||||
|
@ -419,4 +420,10 @@ bool statusOk(int status)
|
||||||
return WIFEXITED(status) && WEXITSTATUS(status) == 0;
|
return WIFEXITED(status) && WEXITSTATUS(status) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int execvpe(const char * file0, char * const argv[], char * const envp[])
|
||||||
|
{
|
||||||
|
auto file = ExecutablePath::load().findPath(file0).string();
|
||||||
|
return execve(file.c_str(), argv, envp);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue