Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not open login shell (-s & -ss option) #93

Closed
greymd opened this issue Jul 28, 2018 · 5 comments
Closed

Do not open login shell (-s & -ss option) #93

greymd opened this issue Jul 28, 2018 · 5 comments

Comments

@greymd
Copy link
Owner

greymd commented Jul 28, 2018

Unify all the work logs about following features.

  -s: Speedy mode: Run commands promptly. But panes are not interactive.
  -ss: Speedy mode and close windows automatically when process ends.

-s option is came from "speedy" or "sh" or something.
I believe this feature solves both #89 #90 .

@greymd
Copy link
Owner Author

greymd commented Jul 28, 2018

Memo: tmux behavior of split-window command.
https://github.com/tmux/tmux/blob/7448b38327f856dae6ce915eae63f7f6c3f036e0/window.c#L983

   * If given one argument, assume it should be passed to sh -c;
   * with more than one argument, use execvp(). If there is no
   * arguments, create a login shell.

https://github.com/tmux/tmux/blob/master/cmd-split-window.c#L122

	shell = options_get_string(s->options, "default-shell");
	if (*shell == '\0' || areshell(shell))
		shell = _PATH_BSHELL;

https://github.com/tmux/tmux/blob/master/compat.h#L65

#define	_PATH_BSHELL	"/bin/sh"

If default-shell is defined, it is used with execl.
-c is also hardcoded.

https://github.com/tmux/tmux/blob/master/cmd-split-window.c#L122

			execl(wp->shell, argv0, "-c", first, (char *)NULL);

Otherwise /bin/sh is used with execvp.

That's why following command does not open login shell.

$ tmux split-window "ls; sleep 1"

Memo: Document about exec series is here.
https://gist.github.com/fffaraz/8a250f896a2297db06c4

@greymd
Copy link
Owner Author

greymd commented Jul 28, 2018

If you want "to execute commands as is, promptly, on the existing pane", then -sex option is required.
Like this.

$ xpanes -sex 'echo '{01..15}

@greymd
Copy link
Owner Author

greymd commented Jul 28, 2018

I am now working on this feature on develop-3.1.0 branch and touch upon the new options.
Finally, I am pretty sure that suppressing closing pane should be default to improve usability.

Let me change the specification of this feature like following.
Abolish -a option. set -ss option instead.

Before:

-s: option:  Speedy mode. Just execute command. Do not make panes interactive.
-a: keep alive option (do not close pane when the command finished when -s option)-s: option:  Speedy mode. Just execute command. D

After:

  -s: Speedy mode: Run commands promptly. But panes are not interactive.
  -ss: Speedy mode and close windows automatically when process ends.

There are three reasons:

  1. xpanes --help displays all the options alphabetical order.
    If -a option is going to be placed upper part of the --help/man page,
    it is difficult for users to notice the relationship between new option and -s option.

  2. It is common to use same letters sequentially in Unix commands.
    i.e: ssh -vvv option.

  3. easier to type than -a

@greymd greymd changed the title Do not open login shell (-s & -a option) Do not open login shell (-s & -ss option) Jul 28, 2018
@greymd greymd mentioned this issue Aug 1, 2018
@greymd
Copy link
Owner Author

greymd commented Aug 2, 2018

This feature is released at v3.1.0

@greymd
Copy link
Owner Author

greymd commented Aug 2, 2018

movie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant