mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
yaft: add "quiet" mode
run the command and collect the output, but do not show it on screen
This commit is contained in:
@@ -104,8 +104,9 @@ static int check_fds(fd_set *fds, struct timeval *tv, int input, int master)
|
||||
return eselect(master + 1, fds, NULL, NULL, tv);
|
||||
}
|
||||
|
||||
YaFT::YaFT(const char * const *argv, int *Res, sigc::signal<void, std::string*, int*, bool*>func)
|
||||
YaFT::YaFT(const char * const *argv, int *Res, bool Paint, sigc::signal<void, std::string*, int*, bool*>func)
|
||||
{
|
||||
paint = Paint;
|
||||
yaft_argv = argv;
|
||||
res = Res;
|
||||
OnShellOutputLoop = func;
|
||||
@@ -164,8 +165,10 @@ int YaFT::run(void)
|
||||
while (child_alive) {
|
||||
if (need_redraw) {
|
||||
need_redraw = false;
|
||||
redraw(&term);
|
||||
refresh(&fb, &term);
|
||||
if (paint) {
|
||||
redraw(&term);
|
||||
refresh(&fb, &term);
|
||||
}
|
||||
}
|
||||
|
||||
if (check_fds(&fds, &tv, STDIN_FILENO, term.fd) == -1)
|
||||
@@ -194,13 +197,16 @@ int YaFT::run(void)
|
||||
term.txt.pop();
|
||||
term.lines_available--;
|
||||
}
|
||||
if (! paint)
|
||||
continue;
|
||||
if (LAZY_DRAW && size == BUFSIZE)
|
||||
continue; /* maybe more data arrives soon */
|
||||
refresh(&fb, &term);
|
||||
}
|
||||
}
|
||||
}
|
||||
refresh(&fb, &term);
|
||||
if (paint)
|
||||
refresh(&fb, &term);
|
||||
|
||||
/* normal exit */
|
||||
term_die(&term);
|
||||
|
@@ -15,10 +15,11 @@ class YaFT : public sigc::trackable
|
||||
{
|
||||
private:
|
||||
int *res;
|
||||
bool paint;
|
||||
public:
|
||||
YaFT(const char * const *argv, int *Res, sigc::signal<void, std::string*, int*, bool*>);
|
||||
YaFT(const char * const *argv, int *Res, bool Paint, sigc::signal<void, std::string*, int*, bool*>);
|
||||
~YaFT();
|
||||
int run();
|
||||
int run(); /* returns exit code */
|
||||
sigc::signal<void, std::string*, int*, bool*> OnShellOutputLoop;
|
||||
};
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user