commit - 05d87bafea0acc2bb9f304b9c1f6f09f13f54dd1
commit + 8f90b2144b015a1c8d566af39e82d48b902b3fff
blob - 2854b26f492bf692171735a33230c519c4799aba
blob + 3b7f41e6036b45cf725f8d66ad576e12a26f39fb
--- 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 - 503a74eafeedeff94d7961e9fce4d014934399bc
blob + a24490e0fe3d13833a74772f5f8b456ee44b3a06
--- 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 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");
}