mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +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);
|
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;
|
yaft_argv = argv;
|
||||||
res = Res;
|
res = Res;
|
||||||
OnShellOutputLoop = func;
|
OnShellOutputLoop = func;
|
||||||
@@ -164,8 +165,10 @@ int YaFT::run(void)
|
|||||||
while (child_alive) {
|
while (child_alive) {
|
||||||
if (need_redraw) {
|
if (need_redraw) {
|
||||||
need_redraw = false;
|
need_redraw = false;
|
||||||
redraw(&term);
|
if (paint) {
|
||||||
refresh(&fb, &term);
|
redraw(&term);
|
||||||
|
refresh(&fb, &term);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_fds(&fds, &tv, STDIN_FILENO, term.fd) == -1)
|
if (check_fds(&fds, &tv, STDIN_FILENO, term.fd) == -1)
|
||||||
@@ -194,13 +197,16 @@ int YaFT::run(void)
|
|||||||
term.txt.pop();
|
term.txt.pop();
|
||||||
term.lines_available--;
|
term.lines_available--;
|
||||||
}
|
}
|
||||||
|
if (! paint)
|
||||||
|
continue;
|
||||||
if (LAZY_DRAW && size == BUFSIZE)
|
if (LAZY_DRAW && size == BUFSIZE)
|
||||||
continue; /* maybe more data arrives soon */
|
continue; /* maybe more data arrives soon */
|
||||||
refresh(&fb, &term);
|
refresh(&fb, &term);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
refresh(&fb, &term);
|
if (paint)
|
||||||
|
refresh(&fb, &term);
|
||||||
|
|
||||||
/* normal exit */
|
/* normal exit */
|
||||||
term_die(&term);
|
term_die(&term);
|
||||||
|
@@ -15,10 +15,11 @@ class YaFT : public sigc::trackable
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int *res;
|
int *res;
|
||||||
|
bool paint;
|
||||||
public:
|
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();
|
~YaFT();
|
||||||
int run();
|
int run(); /* returns exit code */
|
||||||
sigc::signal<void, std::string*, int*, bool*> OnShellOutputLoop;
|
sigc::signal<void, std::string*, int*, bool*> OnShellOutputLoop;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user