mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +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;
|
has_err = false;
|
||||||
tmp_str.clear();
|
tmp_str.clear();
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
if (verbose) {
|
|
||||||
//create CShellWindow object
|
//create CShellWindow object
|
||||||
CShellWindow shell(cmd, (verbose ? CShellWindow::VERBOSE : 0) | (acknowledge ? CShellWindow::ACKNOWLEDGE_EVENT : 0), &res, false);
|
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);
|
shell.OnResultError.connect(sl1);
|
||||||
#endif
|
#endif
|
||||||
shell.exec();
|
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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user