CShellWindow: use internal debug functionality, set init value for pid

This commit is contained in:
2014-11-25 11:31:30 +01:00
parent 3abd9c8e77
commit cd7f4bc79c

View File

@@ -43,6 +43,7 @@
#include <system/helpers.h> #include <system/helpers.h>
#include <gui/widget/messagebox.h> #include <gui/widget/messagebox.h>
#include <errno.h> #include <errno.h>
#include <system/debug.h>
CShellWindow::CShellWindow(const std::string &Command, const int Mode, int *Res) CShellWindow::CShellWindow(const std::string &Command, const int Mode, int *Res)
{ {
@@ -67,18 +68,21 @@ void CShellWindow::exec()
*res = r; *res = r;
else else
*res = WEXITSTATUS(r); *res = WEXITSTATUS(r);
dprintf(DEBUG_NORMAL, "[CShellWindow] [%s - %d] Error! system returns: %d command: %s\n", __func__, __LINE__, *res, cmd.c_str());
} }
return; return;
} }
pid_t pid; pid_t pid = 0;
cmd = command + " 2>&1"; cmd = command + " 2>&1";
FILE *f = my_popen(pid, cmd.c_str(), "r"); FILE *f = my_popen(pid, cmd.c_str(), "r");
if (!f) { if (!f) {
if (res) if (res)
*res = -1; *res = -1;
dprintf(DEBUG_NORMAL, "[CShellWindow] [%s - %d] Error! my_popen returns: %d command: %s\n", __func__, __LINE__, *res, cmd.c_str());
return; return;
} }
Font *font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]; Font *font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO];
unsigned int lines_max = frameBuffer->getScreenHeight() / font->getHeight(); unsigned int lines_max = frameBuffer->getScreenHeight() / font->getHeight();
list<std::string> lines; list<std::string> lines;