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:
Russell Steicke
2013-03-03 20:57:26 +08:00
committed by Paul Beckingham
parent 3dab5a1cb1
commit 1428a4135b
7 changed files with 41 additions and 33 deletions

View File

@@ -67,8 +67,8 @@ void TransportSSH::send(const std::string& source)
_arguments.push_back (_uri._host + ":" + escape (_uri._path, ' '));
}
if (execute())
throw std::string (STRING_TRANSPORT_SSH_NORUN);
if (execute ())
throw std::string (STRING_TRANSPORT_SSH_FAIL);
}
////////////////////////////////////////////////////////////////////////////////
@@ -100,8 +100,8 @@ void TransportSSH::recv(std::string target)
_arguments.push_back (target);
if (execute())
throw std::string (STRING_TRANSPORT_SSH_NORUN);
if (execute ())
throw std::string (STRING_TRANSPORT_SSH_FAIL);
}
////////////////////////////////////////////////////////////////////////////////