-/* $OpenBSD: cmd-run-shell.c,v 1.84 2022/06/02 21:19:32 nicm Exp $ */
+/* $OpenBSD: cmd-run-shell.c,v 1.85 2023/08/23 08:40:25 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
.name = "run-shell",
.alias = "run",
- .args = { "bd:Ct:", 0, 1, cmd_run_shell_args_parse },
- .usage = "[-bC] [-d delay] " CMD_TARGET_PANE_USAGE " [shell-command]",
+ .args = { "bd:Ct:c:", 0, 2, cmd_run_shell_args_parse },
+ .usage = "[-bC] [-c start-directory] [-d delay] " CMD_TARGET_PANE_USAGE
+ " [shell-command]",
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
struct args *args = cmd_get_args(self);
struct cmd_find_state *target = cmdq_get_target(item);
struct cmd_run_shell_data *cdata;
+ struct client *c = cmdq_get_client(item);
struct client *tc = cmdq_get_target_client(item);
struct session *s = target->s;
struct window_pane *wp = target->wp;
cdata->wp_id = -1;
if (wait) {
- cdata->client = cmdq_get_client(item);
+ cdata->client = c;
cdata->item = item;
} else {
cdata->client = tc;
}
if (cdata->client != NULL)
cdata->client->references++;
-
- cdata->cwd = xstrdup(server_client_get_cwd(cmdq_get_client(item), s));
+ if (args_has(args, 'c'))
+ cdata->cwd = xstrdup(args_get(args, 'c'));
+ else
+ cdata->cwd = xstrdup(server_client_get_cwd(c, s));
cdata->s = s;
if (s != NULL)
-.\" $OpenBSD: tmux.1,v 1.928 2023/08/17 14:10:28 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.929 2023/08/23 08:40:25 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: August 17 2023 $
+.Dd $Mdocdate: August 23 2023 $
.Dt TMUX 1
.Os
.Sh NAME
.Tg run
.It Xo Ic run-shell
.Op Fl bC
+.Op Fl c Ar start-directory
.Op Fl d Ar delay
.Op Fl t Ar target-pane
.Op Ar shell-command
.Ar delay
seconds before starting the command.
If
+.Fl c
+is given, the current working directory is set to
+.Ar start-directory .
+If
.Fl C
is not given, any output to stdout is displayed in view mode (in the pane
specified by