mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Clean up Transport::execute() and callers.
- Ensure that the real exit code of the child program is retrieved using WEXITSTATUS(). - Centralise the handling of code 127, which means that the child shell process could not execute its child (ssh, rsync, or curl.) Signed-off-by: Russell Steicke <russells@adelie.cx>
This commit is contained in:
parent
3dab5a1cb1
commit
1428a4135b
7 changed files with 41 additions and 33 deletions
|
@ -417,7 +417,7 @@ int execute(const std::string& executable, std::vector<std::string> arguments)
|
|||
cmdline += " " + (std::string)*it;
|
||||
}
|
||||
|
||||
context.debug ("Executing: " + std::string(shell) + " " + std::string(opt) + " " + cmdline);
|
||||
context.debug ("Executing: " + std::string(shell) + " " + std::string(opt) + " " + cmdline);
|
||||
|
||||
pid_t child_pid = fork();
|
||||
|
||||
|
@ -435,6 +435,10 @@ int execute(const std::string& executable, std::vector<std::string> arguments)
|
|||
|
||||
exit(ret);
|
||||
}
|
||||
else if (child_pid == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// this is done by the parent process
|
||||
|
@ -445,7 +449,7 @@ int execute(const std::string& executable, std::vector<std::string> arguments)
|
|||
if (pid == -1)
|
||||
return -1;
|
||||
else
|
||||
return child_status;
|
||||
return WEXITSTATUS (child_status);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue