CShellWindow/COPKGManager: handle some error from shell output

TODO: add missing handlers
This commit is contained in:
2015-05-23 22:52:57 +02:00
parent 982fbb962e
commit ed5bbdc540
4 changed files with 133 additions and 61 deletions

View File

@@ -68,6 +68,34 @@ class COPKGManager : public CMenuTarget
std::string *local_dir;
bool has_err;
typedef struct om_error_data_t
{
std::string id;
int num;
}om_error_struct_t;
//error types
enum
{
OM_UNKNOWN_ERR =-1,
OM_SUCCESS = 0,
OM_UNSATISFIED_DEPS_ERR = 5,
OM_DOWNLOAD_ERR = 11,
OM_CONFLICT_ERR = 12,
OM_OUT_OF_SPACE_ERR = 15,
OM_PREREM_SCRIPT_ERR = 16,
};
om_error_data_t *err_list;
void OM_ERRORS()
{
static om_error_data_t errlist[] = { { "Cannot satisfy the following dependencies" , OM_UNSATISFIED_DEPS_ERR },
{ "No space left on device" , OM_OUT_OF_SPACE_ERR },
{ "The following packages conflict" , OM_CONFLICT_ERR },
{ "Only have" , OM_OUT_OF_SPACE_ERR },
{ "prerm script for package" , OM_PREREM_SCRIPT_ERR },
} ;
err_list = errlist;
};
void showErr(int* res);
std::string err_msg;
int execCmd(const char* cmdstr, bool verbose = false, bool acknowledge = false);
@@ -100,7 +128,7 @@ class COPKGManager : public CMenuTarget
bool badpackage(std::string &s);
void showError(const char* local_msg, char* err_msg, const std::string& command);
int doUpdate();
void handleShellOutput(std::string& cur_line);
void handleShellOutput(std::string* cur_line, int* res, bool* ok);
struct pkg {
std::string name;