commit - 7ddea6c5284750e02983e76f44f19c65e51c638a
commit + b9a64d45f6bf202e384c314e9e8b2b303e5d4f49
blob - 57d01ea586adb3381066c9342720bcb3642f4165
blob + f137ba2586ebfbe7c474fbb7bb5b47c357206b4e
--- cmd.c
+++ cmd.c
cmd_kill_telescope(struct buffer *buffer)
{
yornp("really quit?", kill_telescope_cb, NULL);
+}
+
+#include <curses.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <errno.h>
+static void
+do_exec_command(const char *cmd, struct tab *t)
+{
+ int s;
+ pid_t p;
+
+ if (cmd == NULL)
+ return;
+
+ endwin();
+
+ switch (p = fork()) {
+ case -1:
+ message("failed to fork: %s", strerror(errno));
+ return;
+ case 0:
+ execl("/bin/sh", "sh", "-c", cmd, NULL);
+ warn("exec \"%s\" failed", cmd);
+ _exit(1);
+ }
+
+again:
+ if (waitpid(p, &s, 0) == -1) {
+ if (errno == EINTR)
+ goto again;
+ }
+
+ refresh();
+ clear();
+ ui_schedule_redraw();
+ /* rearrange_windows(); */
}
void
else
buffer->line_max++;
}
+ break;
+ case LINE_DOWNLOAD:
+ case LINE_DOWNLOAD_DONE:
+ minibuffer_read("Execute: ", do_exec_command,
+ NULL);
+ snprintf(ministate.buf, sizeof(ministate.buf),
+ "xdg-open %s", vl->parent->alt);
break;
default:
break;
blob - 18faddf332d53538a16d8ceeb2b47af6ba6be5ca
blob + 93d2b08be50bfeaa5e4a9a49c0c0cddb022d752f
--- sandbox.c
+++ sandbox.c
if (unveil(cache_path_base, "rwc") == -1)
err(1, "unveil(%s)", cache_path_base);
- if (pledge("stdio rpath wpath cpath unix sendfd tty", NULL) == -1)
+ if (unveil("/bin/sh", "rx") == -1)
+ err(1, "unveil(xdg-open)");
+
+ if (pledge("stdio rpath wpath cpath unix tty proc exec",
+ NULL) == -1)
err(1, "pledge");
}