mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug #548
- Fixed issue with push command where curl transfers only pending.data - Differentiate between "command not found" and other errors
This commit is contained in:
parent
94480c23d2
commit
4cb5caa342
1 changed files with 19 additions and 21 deletions
|
@ -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 ("-T");
|
||||
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())
|
||||
throw std::string ("Could not run curl. Is it installed, and available in $PATH?");
|
||||
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())
|
||||
throw std::string ("Could not run curl. Is it installed, and available in $PATH?");
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue