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:
committed by
Paul Beckingham
parent
3dab5a1cb1
commit
1428a4135b
@@ -80,14 +80,8 @@ void TransportCurl::send(const std::string& source)
|
||||
_arguments.push_back (_uri._protocol + "://" + _uri._host + "/" + _uri._path);
|
||||
}
|
||||
|
||||
int result = execute();
|
||||
if (result)
|
||||
{
|
||||
if (result == 127) // command not found
|
||||
throw std::string (STRING_TRANSPORT_CURL_NORUN);
|
||||
else
|
||||
throw std::string (STRING_TRANSPORT_CURL_FAIL);
|
||||
}
|
||||
if (execute ())
|
||||
throw std::string (STRING_TRANSPORT_CURL_FAIL);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -148,14 +142,8 @@ void TransportCurl::recv(std::string target)
|
||||
|
||||
_arguments.insert (_arguments.end (), targetargs.begin (), targetargs.end ());
|
||||
|
||||
int result = execute();
|
||||
if (result)
|
||||
{
|
||||
if (result == 127) // command not found
|
||||
throw std::string (STRING_TRANSPORT_CURL_NORUN);
|
||||
else
|
||||
throw std::string (STRING_TRANSPORT_CURL_FAIL);
|
||||
}
|
||||
if (execute ())
|
||||
throw std::string (STRING_TRANSPORT_CURL_FAIL);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user