1ère version fonctionnelle

This commit is contained in:
2023-01-12 09:23:45 +01:00
parent a76f32ea30
commit 789317ea12
9 changed files with 273 additions and 150 deletions
+6 -3
View File
@@ -42,7 +42,7 @@ const vector<string> explode(const string& s, const char& c, int n = 0)
return v;
}
FILE * popen2(char * cmd, string type, int & pid)
FILE * popen2(array<string, 7> argv, string type, int & pid)
{
pid_t child_pid;
int fd[2];
@@ -69,8 +69,11 @@ FILE * popen2(char * cmd, string type, int & pid)
}
setpgid(child_pid, child_pid); //Needed so negative PIDs can kill children of /bin/sh
execl(cmd, "");
exit(0);
if (execl(argv[0].c_str(), argv[0].c_str(), argv[1].c_str(), argv[2].c_str(), argv[3].c_str(), argv[4].c_str(), argv[5].c_str(), NULL ) == -1)
{
perror("execl error => ");
}
exit (0);
}
else
{