mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-21 20:52:19 +00:00
Expand environment variables in the shell option
See #6511 for discussion
This commit is contained in:
parent
3d6c3a9979
commit
76c6f91685
3 changed files with 16 additions and 2 deletions
|
|
@ -52,6 +52,8 @@ Detailed list of changes
|
|||
|
||||
- themes kitten: Allow absolute paths for ``--config-file-name`` (:iss:`6638`)
|
||||
|
||||
- Expand environment variables in the :opt:`shell` option (:iss:`6511`)
|
||||
|
||||
|
||||
0.30.0 [2023-09-18]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
|||
|
|
@ -2782,7 +2782,7 @@ The shell program to execute. The default value of :code:`.` means to use
|
|||
whatever shell is set as the default shell for the current user. Note that on
|
||||
macOS if you change this, you might need to add :code:`--login` and
|
||||
:code:`--interactive` to ensure that the shell starts in interactive mode and
|
||||
reads its startup rc files.
|
||||
reads its startup rc files. Environment variables are expanded in this setting.
|
||||
'''
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -771,7 +771,19 @@ def resolved_shell(opts: Optional[Options] = None) -> List[str]:
|
|||
ans = [shell_path]
|
||||
else:
|
||||
import shlex
|
||||
ans = shlex.split(q)
|
||||
env = {}
|
||||
if opts is not None:
|
||||
env['TERM'] = opts.term
|
||||
if 'SHELL' not in os.environ:
|
||||
env['SHELL'] = shell_path
|
||||
if 'HOME' not in os.environ:
|
||||
env['HOME'] = os.path.expanduser('~')
|
||||
if 'USER' not in os.environ:
|
||||
import pwd
|
||||
env['USER'] = pwd.getpwuid(os.geteuid()).pw_name
|
||||
def expand(x: str) -> str:
|
||||
return expandvars(x, env)
|
||||
list(map(expand, shlex.split(q)))
|
||||
return ans
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue