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

Have wezterm -e start with --always-new-process #4523

Closed
Ram-Z opened this issue Nov 2, 2023 · 5 comments
Closed

Have wezterm -e start with --always-new-process #4523

Ram-Z opened this issue Nov 2, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@Ram-Z
Copy link

Ram-Z commented Nov 2, 2023

This is a follow up of #2782.

Most terminals will not attach to a running instance of a daemon and therefore are blocking when invoked with -e. Some tools rely on waiting for the spawned program to terminate.

In my case I had qutebrowsers external editor command set to $TERMINAL -e vim {file}. qutebrowser would create file and wait for vim to finish before reading and deleting it. With TERMINAL=wezterm this didn't work as the file got deleted immediately.

Describe the solution you'd like
wezterm -e should behave as if wezterm start --always-new-process.

Describe alternatives you've considered
I now handle TERMINAL==wezterm specially and start it as a new process, but I'd rather it just worked with -e.

@Ram-Z Ram-Z added the enhancement New feature or request label Nov 2, 2023
@vimpostor
Copy link
Contributor

vimpostor commented Nov 3, 2023

I agree, -e should start a blocking wezterm for compatibility reasons.

I think wezterm start should still not use --always-new-process by default, only the -e alias should start a new process by default. I can send in a patch later. I don't have a strong opinion though, so if @wez wants start and -e to be always consistent, then that's fine with me too.

@Ram-Z
Copy link
Author

Ram-Z commented Nov 4, 2023

I think wezterm start should still not use --always-new-process by default.

I agree.

I don't have a strong opinion though, so if @wez wants start and -e to be always consistent, then that's fine with me too.

Yeah, and if that means that -e continues to behave the way it does now, that's fine too.

@wez
Copy link
Owner

wez commented Nov 4, 2023

I think this request makes sense, but I'm not sure whether the clap library can make it work that way. If you'd like to look into how to make that work, I'd be happy to review a PR for it!

@vimpostor
Copy link
Contributor

vimpostor commented Nov 5, 2023

but I'm not sure whether the clap library can make it work that way

There is no way to implement it while keeping it as a simple clap alias, because clap uses a bijective mapping model, so there is no way to have different behaviour between different aliases: All aliases are the same element to clap and you can't determine which alias was used.

However that's no problem, it is easy to fake this with only a few lines of code.

vimpostor added a commit to vimpostor/wezterm that referenced this issue Nov 5, 2023
This is done for compatibility, as many tools assume that running a
command with "$TERMINAL -e $COMMAND" blocks until the command is
finished.

For example some tools delete a needed file after the command returns.
But since we always return immediately (in case --always-new-process is
not provided and if another wezterm instance is already running), this
would mean that the file is deleted before the command could do
anything.

Fixes wez#4523
vimpostor added a commit to vimpostor/wezterm that referenced this issue Nov 5, 2023
This is done for compatibility, as many tools assume that running a
command with "$TERMINAL -e $COMMAND" blocks until the command is
finished.

For example some tools delete a needed file after the command returns.
But since we always return immediately (in case --always-new-process is
not provided and if another wezterm instance is already running), this
would mean that the file is deleted before the command could do
anything.

Fixes wez#4523
vimpostor added a commit to vimpostor/wezterm that referenced this issue Nov 5, 2023
This is done for compatibility, as many tools assume that running a
command with "$TERMINAL -e $COMMAND" blocks until the command is
finished.

For example some tools delete a needed file after the command returns.
But since we always return immediately (in case --always-new-process is
not provided and if another wezterm instance is already running), this
would mean that the file is deleted before the command could do
anything.

Fixes wez#4523
@wez wez closed this as completed in 191d281 Feb 3, 2024
wez added a commit that referenced this issue Feb 3, 2024
Copy link
Contributor

github-actions bot commented Mar 5, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants