summaryrefslogtreecommitdiffstats
path: root/format.c
diff options
context:
space:
mode:
authornicm <nicm>2014-05-13 08:08:32 +0000
committernicm <nicm>2014-05-13 08:08:32 +0000
commitb3e8d440ed0477e88232c3ba1779c67eafce3a48 (patch)
tree09e92eb59a30d393132b4da6d8cc3d3623f755b2 /format.c
parentb1a06ef22e54e943d733db8dcc98fe60051c93de (diff)
If multiple arguments are given to new-session, new-window,
split-window, respawn-window or respawn-pane, pass them directly to execvp() to help avoid quoting problems. One argument still goes to "sh -c" like before. Requested by many over the years. Patch from J Raynor.
Diffstat (limited to 'format.c')
-rw-r--r--format.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/format.c b/format.c
index 028031a0..10e5e0a8 100644
--- a/format.c
+++ b/format.c
@@ -368,7 +368,7 @@ format_get_command(struct window_pane *wp)
cmd = get_proc_name(wp->fd, wp->tty);
if (cmd == NULL || *cmd == '\0') {
free(cmd);
- cmd = xstrdup(wp->cmd);
+ cmd = cmd_stringify_argv(wp->argc, wp->argv);
if (cmd == NULL || *cmd == '\0') {
free(cmd);
cmd = xstrdup(wp->shell);
@@ -559,8 +559,10 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
if (wp->tty != NULL)
format_add(ft, "pane_tty", "%s", wp->tty);
format_add(ft, "pane_pid", "%ld", (long) wp->pid);
- if (wp->cmd != NULL)
- format_add(ft, "pane_start_command", "%s", wp->cmd);
+ if ((cmd = cmd_stringify_argv(wp->argc, wp->argv)) != NULL) {
+ format_add(ft, "pane_start_command", "%s", cmd);
+ free(cmd);
+ }
if ((cmd = format_get_command(wp)) != NULL) {
format_add(ft, "pane_current_command", "%s", cmd);
free(cmd);