1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-04 07:11:47 +02:00

Merge pull request #11021 from hercules-ci/issue-11010

Fix SSH invocation when local SHELL misbehaves
This commit is contained in:
tomberek 2024-08-26 10:40:51 -04:00 committed by GitHub
commit 440de80d34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 67 additions and 4 deletions

13
src/libutil/unix/exec.hh Normal file
View 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[]);
}

View file

@ -13,6 +13,7 @@ sources += files(
include_dirs += include_directories('.')
headers += files(
'exec.hh',
'monitor-fd.hh',
'signals-impl.hh',
)

View file

@ -1,5 +1,6 @@
#include "current-process.hh"
#include "environment-variables.hh"
#include "executable-path.hh"
#include "signals.hh"
#include "processes.hh"
#include "finally.hh"
@ -419,4 +420,10 @@ bool statusOk(int status)
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);
}
}