mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Code Cleanup
- util.cpp execute was assuming execvp was returning before freeing memory, which is a waste of time.
This commit is contained in:
parent
b4438b4e8f
commit
7c8432d162
1 changed files with 3 additions and 6 deletions
|
@ -405,8 +405,8 @@ int execute (
|
||||||
pipe (pin);
|
pipe (pin);
|
||||||
pipe (pout);
|
pipe (pout);
|
||||||
|
|
||||||
pid_t pid = fork();
|
pid_t pid = fork ();
|
||||||
if (!pid)
|
if (pid == 0)
|
||||||
{
|
{
|
||||||
// This is only reached in the child
|
// This is only reached in the child
|
||||||
dup2 (pin[0], STDIN_FILENO);
|
dup2 (pin[0], STDIN_FILENO);
|
||||||
|
@ -417,10 +417,7 @@ int execute (
|
||||||
argv[i] = (char*) args[i].c_str ();
|
argv[i] = (char*) args[i].c_str ();
|
||||||
|
|
||||||
argv[args.size ()] = NULL;
|
argv[args.size ()] = NULL;
|
||||||
|
exit (execvp (executable.c_str (), argv));
|
||||||
int ret = execvp (executable.c_str (), argv);
|
|
||||||
delete[] argv;
|
|
||||||
exit (ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is only reached in the parent
|
// This is only reached in the parent
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue