In RHEL 7.3, when using subprocess_create with a 0 for the environment option, if I don't specify the full path of the binary, the call to execvp fails and returns 255.
const char * command_line[] = { "sleep", "10", NULL };
struct subprocess_s subprocess;
int result = subprocess_create(command_line, 0, &subprocess);
if (0 != result)
{
std::cerr << "Error with subprocess" << std::endl;
}
int retcode = 0;
result = subprocess_join(&subprocess, &retcode);
if (0 != result)
{
std::cerr << "Error joining subprocess" << std::endl;
}
std::cout << "Ret code: " << retcode << std::endl; // This prints 255
In RHEL 7.3, when using
subprocess_create
with a0
for the environment option, if I don't specify the full path of the binary, the call to execvp fails and returns 255.However, if I use any environment option, like
subprocess_option_inherit_environment
, your lib uses execve instead, which does need to have the full path. Here's a better explanation for that behavior.To my understanding, the behavior should be consistent in both cases.