mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
COPKGManager: use strictly shell window object to execute commands
This commit is contained in:
@@ -676,7 +676,7 @@ int COPKGManager::execCmd(const char *cmdstr, bool verbose, bool acknowledge)
|
||||
has_err = false;
|
||||
tmp_str.clear();
|
||||
bool ok = true;
|
||||
if (verbose) {
|
||||
|
||||
//create CShellWindow object
|
||||
CShellWindow shell(cmd, (verbose ? CShellWindow::VERBOSE : 0) | (acknowledge ? CShellWindow::ACKNOWLEDGE_EVENT : 0), &res, false);
|
||||
|
||||
@@ -691,24 +691,7 @@ int COPKGManager::execCmd(const char *cmdstr, bool verbose, bool acknowledge)
|
||||
shell.OnResultError.connect(sl1);
|
||||
#endif
|
||||
shell.exec();
|
||||
} else {
|
||||
cmd += " 2>&1";
|
||||
pid_t pid = 0;
|
||||
FILE *f = my_popen(pid, cmd.c_str(), "r");
|
||||
if (!f) {
|
||||
showError("OPKG-Error!", strerror(errno), cmd);
|
||||
return -1;
|
||||
}
|
||||
char buf[256];
|
||||
do {
|
||||
string line(buf);
|
||||
trim(line);
|
||||
handleShellOutput(&line, &res, &ok);
|
||||
dprintf(DEBUG_INFO, "[COPKGManager] [%s - %d] %s [error %d]\n", __func__, __LINE__, line.c_str(), has_err);
|
||||
} while (fgets(buf, sizeof(buf), f) && ok);
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user