mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-03 16:46:18 +00:00 
			
		
		
		
	Expand format variables in the run-shell and if-shell shell commands,
from Thiago Padilha.
This commit is contained in:
		@@ -75,14 +75,25 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
{
 | 
			
		||||
	struct args			*args = self->args;
 | 
			
		||||
	struct cmd_run_shell_data	*cdata;
 | 
			
		||||
	const char			*shellcmd = args->argv[0];
 | 
			
		||||
	char				*shellcmd;
 | 
			
		||||
	struct session			*s;
 | 
			
		||||
	struct winlink			*wl;
 | 
			
		||||
	struct window_pane		*wp;
 | 
			
		||||
	struct format_tree		*ft;
 | 
			
		||||
 | 
			
		||||
	if (cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp) == NULL)
 | 
			
		||||
	wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp);
 | 
			
		||||
	if (wl == NULL)
 | 
			
		||||
		return (CMD_RETURN_ERROR);
 | 
			
		||||
 | 
			
		||||
	ft = format_create();
 | 
			
		||||
	format_session(ft, s);
 | 
			
		||||
	format_winlink(ft, s, wl);
 | 
			
		||||
	format_window_pane(ft, wp);
 | 
			
		||||
	shellcmd = format_expand(ft, args->argv[0]);
 | 
			
		||||
	format_free(ft);
 | 
			
		||||
 | 
			
		||||
	cdata = xmalloc(sizeof *cdata);
 | 
			
		||||
	cdata->cmd = xstrdup(args->argv[0]);
 | 
			
		||||
	cdata->cmd = shellcmd;
 | 
			
		||||
	cdata->wp_id = wp->id;
 | 
			
		||||
 | 
			
		||||
	cdata->ctx = ctx;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user