commit 12b8b8a338d1791ce2d200f7cad99c9f0b5804d1 escapeinsert <ben@0x1bi.net> 2021-10-02 15:19:30 -0400 Add modal plumber With this option activated, sacc will wait for the plumber to return before continuing its execution.
config.def.h | 3 +++ sacc.c | 5 +++++ 2 files changed, 8 insertions(+)
diff --git a/config.def.h b/config.def.h index 10ffb6d..f744d34 100644 --- a/config.def.h +++ b/config.def.h @@ -23,6 +23,9 @@ /* default plumber */ static char *plumber = "xdg-open"; +/* modal plumber will make sacc wait for the plumber to return */ +static int modalplumber = 0; + /* temporary directory template (must end with six 'X' characters) */ static char tmpdir[] = "/tmp/sacc-XXXXXX"; diff --git a/sacc.c b/sacc.c index fd74b54..7a25fae 100644 --- a/sacc.c +++ b/sacc.c @@ -651,6 +651,11 @@ plumb(char *url) dup2(devnullfd, 2); if (execlp(plumber, plumber, url, NULL) == -1) _exit(1); + default: + if (modalplumber) { + while (waitpid(-1, NULL, 0) != -1) + ; + } } diag("Plumbed \"%s\"", url);