mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
Make sure we have an execvpe
on Windows too
Necessary to fix a build (that was already broken in other ways) after PR #11021.
This commit is contained in:
parent
88998fae74
commit
dbabfc92d4
5 changed files with 20 additions and 5 deletions
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "os-string.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,6 +10,9 @@ namespace nix {
|
||||||
*
|
*
|
||||||
* We use our own implementation unconditionally for consistency.
|
* We use our own implementation unconditionally for consistency.
|
||||||
*/
|
*/
|
||||||
int execvpe(const char * file0, char * const argv[], char * const envp[]);
|
int execvpe(
|
||||||
|
const OsString::value_type * file0,
|
||||||
|
const OsString::value_type * const argv[],
|
||||||
|
const OsString::value_type * const envp[]);
|
||||||
|
|
||||||
}
|
}
|
|
@ -129,6 +129,7 @@ sources = files(
|
||||||
'english.cc',
|
'english.cc',
|
||||||
'environment-variables.cc',
|
'environment-variables.cc',
|
||||||
'error.cc',
|
'error.cc',
|
||||||
|
'exec.hh',
|
||||||
'executable-path.cc',
|
'executable-path.cc',
|
||||||
'exit.cc',
|
'exit.cc',
|
||||||
'experimental-features.cc',
|
'experimental-features.cc',
|
||||||
|
|
|
@ -13,7 +13,6 @@ 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',
|
||||||
)
|
)
|
||||||
|
|
|
@ -420,10 +420,12 @@ 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[])
|
int execvpe(const char * file0, const char * const argv[], const char * const envp[])
|
||||||
{
|
{
|
||||||
auto file = ExecutablePath::load().findPath(file0).string();
|
auto file = ExecutablePath::load().findPath(file0);
|
||||||
return execve(file.c_str(), argv, envp);
|
// `const_cast` is safe. See the note in
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9799919799/functions/exec.html
|
||||||
|
return execve(file.c_str(), const_cast<char *const *>(argv), const_cast<char *const *>(envp));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "current-process.hh"
|
#include "current-process.hh"
|
||||||
#include "environment-variables.hh"
|
#include "environment-variables.hh"
|
||||||
#include "error.hh"
|
#include "error.hh"
|
||||||
|
#include "executable-path.hh"
|
||||||
#include "file-descriptor.hh"
|
#include "file-descriptor.hh"
|
||||||
#include "file-path.hh"
|
#include "file-path.hh"
|
||||||
#include "signals.hh"
|
#include "signals.hh"
|
||||||
|
@ -377,4 +378,11 @@ bool statusOk(int status)
|
||||||
{
|
{
|
||||||
return status == 0;
|
return status == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int execvpe(const wchar_t * file0, const wchar_t * const argv[], const wchar_t * const envp[])
|
||||||
|
{
|
||||||
|
auto file = ExecutablePath::load().findPath(file0);
|
||||||
|
return _wexecve(file.c_str(), argv, envp);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue