- Fixed issue with push command where curl transfers
  only pending.data
- Differentiate between "command not found" and other errors
This commit is contained in:
Johannes Schlatow 2010-11-22 01:15:19 +01:00
parent 94480c23d2
commit 4cb5caa342

View file

@ -58,23 +58,8 @@ void TransportCurl::send(const std::string& source)
if (!uri.is_directory())
throw std::string ("The uri '") + uri.path + "' does not appear to be a directory.";
std::string toSplit;
std::string suffix;
std::string prefix;
std::vector<std::string> splitted;
prefix = source.substr (0, pos);
toSplit = source.substr (pos+1);
pos = toSplit.find ("}");
suffix = toSplit.substr (pos+1);
split (splitted, toSplit.substr(0, pos), ',');
foreach (file, splitted)
{
arguments.push_back ("-T");
arguments.push_back (prefix + *file + suffix);
}
arguments.push_back ("\"" + source + "\"");
}
else
{
@ -92,8 +77,14 @@ void TransportCurl::send(const std::string& source)
arguments.push_back (uri.protocol + "://" + uri.host + "/" + uri.path);
}
if (execute())
int result = execute();
if (result)
{
if (result == 127) // command not found
throw std::string ("Could not run curl. Is it installed, and available in $PATH?");
else
throw std::string ("Curl failed, see output above.");
}
}
////////////////////////////////////////////////////////////////////////////////
@ -152,8 +143,15 @@ void TransportCurl::recv(std::string target)
arguments.push_back (target);
if (execute())
int result = execute();
if (result)
{
if (result == 127) // command not found
throw std::string ("Could not run curl. Is it installed, and available in $PATH?");
else
throw std::string ("Curl failed, see output above.");
}
}
////////////////////////////////////////////////////////////////////////////////
// vim: ts=2 sw=2 et