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

Don't resolve symlink passed to --directory #1595

Closed
rightaway opened this issue May 7, 2019 · 4 comments
Closed

Don't resolve symlink passed to --directory #1595

rightaway opened this issue May 7, 2019 · 4 comments

Comments

@rightaway
Copy link

I'm opening kitty with --directory but it looks like it resolves the symlink before going to the path. The directory should be opened as given with no symlink resolution. I think it could be the default behavior but if it not then maybe a config option not to resolve symlinks?

@egmontkob
Copy link

I doubt Kitty explicitly resolves anything. Instead, I think it changes to the given directory, and when the child process is launched it's by Unix design that the path that led there (possibly including symlinks) isn't forwarded, it's just the final location that the child process (shell) is aware of, which will be displayed using its canonical path.

The solution Kitty could apply is to set the PWD environment variable to the given string. See e.g. get_current_dir_name(3). By convention, if this environment variable is set and indeed points to the current directory then the path contained in this variable (possibly containing symlinks) is used. This is supported by at least bash, but I assume pretty much all shells.

@rightaway
Copy link
Author

Child process in this case means the shell that's launched?

I hope there's a way to change it either in terminal or shell or somewhere because right now I'm manually changing to the symlink dir instead of opening it there automatically because the original dir names are very messy (I know it's just a cosmetic minor thing though).

@egmontkob
Copy link

Yep the child is usually the shell.

Meta: I'm not Kitty's developer, and my comment was primarily addressed to him. He may or may not be aware of PWD's aforementioned behavior, I don't think it's common knowledge. If he accepts my proposal and sets PWD in Kitty, it'll just work for you. Until then, a wrapper script in front of Kitty which exports this variable and starts Kitty with the same --directory probably works as well (at least works for me).

@kovidgoyal
Copy link
Owner

sure setting PWD seems like a a worthwhile thing to do.

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

3 participants