Provide correct arguments to execvp

Previously no arguments were provided, but by convention argv[0] should
be the name of the program.

Providing this argumens enables Psuedoterminal node to work on macOS.
This commit is contained in:
Leroy Hopson 2020-11-21 12:02:29 +07:00 committed by Leroy Hopson
parent b2dc46636c
commit 570896b9c0

View file

@ -1,7 +1,8 @@
#include "pseudoterminal.h" #include "pseudoterminal.h"
#include <unistd.h> #include <libgen.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <termios.h> #include <termios.h>
#include <unistd.h>
// Platform specific includes. // Platform specific includes.
#if defined(PLATFORM_LINUX) #if defined(PLATFORM_LINUX)
@ -77,7 +78,8 @@ void Pseudoterminal::process_pty()
putenv(colortermenv); putenv(colortermenv);
char *shell = getenv("SHELL"); char *shell = getenv("SHELL");
execvp(shell, NULL); char *argv[] = { basename(shell), NULL };
execvp(shell, argv);
} }
else else
{ {