diff options
author | 2011-01-26 01:54:56 +0000 | |
---|---|---|
committer | 2011-01-26 01:54:56 +0000 | |
commit | fc92b485eac2697c63e7604a4269f438852fe044 (patch) | |
tree | ee8a6fedc2dc25221420aaef35e90f4e87c12bd0 /usr.bin/tmux/cmd-run-shell.c | |
parent | sync (diff) | |
download | wireguard-openbsd-fc92b485eac2697c63e7604a4269f438852fe044.tar.xz wireguard-openbsd-fc92b485eac2697c63e7604a4269f438852fe044.zip |
Simplify the way jobs work and drop the persist type, so all jobs are
fire-and-forget.
Status jobs now managed with two trees of output (new and old), rather
than storing the output in the jobs themselves. When the status line is
processed any jobs which don't appear in the new tree are started and
the output from the old tree displayed. When a job finishes it updates
the new tree with its output and that is used for any subsequent
redraws. When the status interval expires, the new tree is moved to the
old so that all jobs are run again.
This fixes the "#(echo %H:%M:%S)" problem which would lead to thousands
of identical persistent jobs and high memory use (this can still be
achieved by adding "sleep 30" but that is much less likely to happen by
accident).
Diffstat (limited to 'usr.bin/tmux/cmd-run-shell.c')
-rw-r--r-- | usr.bin/tmux/cmd-run-shell.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c index f87f7f872dc..7e08e4ce779 100644 --- a/usr.bin/tmux/cmd-run-shell.c +++ b/usr.bin/tmux/cmd-run-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-run-shell.c,v 1.10 2011/01/04 00:42:47 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.11 2011/01/26 01:54:56 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -53,7 +53,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; struct cmd_run_shell_data *cdata; - struct job *job; + const char *shellcmd = args->argv[0]; cdata = xmalloc(sizeof *cdata); cdata->cmd = xstrdup(args->argv[0]); @@ -64,9 +64,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_ctx *ctx) if (ctx->curclient != NULL) ctx->curclient->references++; - job = job_add(NULL, 0, NULL, - args->argv[0], cmd_run_shell_callback, cmd_run_shell_free, cdata); - job_run(job); + job_run(shellcmd, cmd_run_shell_callback, cmd_run_shell_free, cdata); return (1); /* don't let client exit */ } |