<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ghostty.git/src/termio/shell_integration.zig, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/'/>
<entry>
<title>Zig 0.15: zig build test </title>
<updated>2025-10-03T14:10:43+00:00</updated>
<author>
<name>Mitchell Hashimoto</name>
<email>m@mitchellh.com</email>
</author>
<published>2025-10-01T20:10:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=cb295b84a0ec274a43da59041fa4a199e799798d'/>
<id>cb295b84a0ec274a43da59041fa4a199e799798d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>feat: add GHOSTTY_BIN_DIR to path via shell integration</title>
<updated>2025-09-30T17:26:20+00:00</updated>
<author>
<name>Matthew Hrehirchuk</name>
<email>matthew_hre@outlook.com</email>
</author>
<published>2025-09-30T17:23:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=4cc663fc6003aa6626d4a9c73f1763b862dc569f'/>
<id>4cc663fc6003aa6626d4a9c73f1763b862dc569f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>zsh: add tests for setupZsh</title>
<updated>2025-08-19T14:35:05+00:00</updated>
<author>
<name>Jon Parise</name>
<email>jon@indelible.org</email>
</author>
<published>2025-08-19T14:35:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=f430c03ff3e094fd917f10a955160884579aa143'/>
<id>f430c03ff3e094fd917f10a955160884579aa143</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bash: preserve an existing ENV value</title>
<updated>2025-07-10T19:47:55+00:00</updated>
<author>
<name>Jon Parise</name>
<email>jon@indelible.org</email>
</author>
<published>2025-07-10T19:12:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=01233a48d14cb9ae191c085a386bccfbafb91243'/>
<id>01233a48d14cb9ae191c085a386bccfbafb91243</id>
<content type='text'>
Our bash shell integration code uses ENV (in POSIX mode) to bootstrap
our shell integration script. This had the side effect of overwriting an
existing ENV value.

This change preserves ENV by storing it temporarily in GHOSTTY_BASH_ENV.

Note that this doesn't enable --posix mode support for automatic shell
integration. (--posix does work; we just skip shell integration when
that flag is specified.) We can reconsider implementing full --posix
support separately.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our bash shell integration code uses ENV (in POSIX mode) to bootstrap
our shell integration script. This had the side effect of overwriting an
existing ENV value.

This change preserves ENV by storing it temporarily in GHOSTTY_BASH_ENV.

Note that this doesn't enable --posix mode support for automatic shell
integration. (--posix does work; we just skip shell integration when
that flag is specified.) We can reconsider implementing full --posix
support separately.
</pre>
</div>
</content>
</entry>
<entry>
<title>cli: rewrite ssh-cache diskcache and test IO</title>
<updated>2025-07-09T16:20:14+00:00</updated>
<author>
<name>Mitchell Hashimoto</name>
<email>m@mitchellh.com</email>
</author>
<published>2025-07-09T14:28:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=8ab3010bb8d2f14a36b6f0f6b3f26fd9e26bbb5b'/>
<id>8ab3010bb8d2f14a36b6f0f6b3f26fd9e26bbb5b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>test: update shell integration tests for SSH flags</title>
<updated>2025-06-25T22:46:18+00:00</updated>
<author>
<name>Jason Rayne</name>
<email>yo@arcayne.dev</email>
</author>
<published>2025-06-24T19:00:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=bbb02a83923c25be263b51c35779b5e1dbff4a44'/>
<id>bbb02a83923c25be263b51c35779b5e1dbff4a44</id>
<content type='text'>
Add ssh-env and ssh-terminfo fields to existing setupFeatures tests.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add ssh-env and ssh-terminfo fields to existing setupFeatures tests.
</pre>
</div>
</content>
</entry>
<entry>
<title>change: migrate SSH integration from standalone option to shell-integration-features flags</title>
<updated>2025-06-25T22:46:18+00:00</updated>
<author>
<name>Jason Rayne</name>
<email>yo@arcayne.dev</email>
</author>
<published>2025-06-24T05:34:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=e73313ed40bf7da202688709e634c7a0b934c553'/>
<id>e73313ed40bf7da202688709e634c7a0b934c553</id>
<content type='text'>
- Add ssh_env and ssh_terminfo flags to ShellIntegrationFeatures
- Remove SSHIntegration enum and ssh-integration config option
- Update setupFeatures to handle new flags via reflection
- Remove setupSSHIntegration function and all references

Integrates SSH functionality into existing shell-integration-features
system for better consistency and user control.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Add ssh_env and ssh_terminfo flags to ShellIntegrationFeatures
- Remove SSHIntegration enum and ssh-integration config option
- Update setupFeatures to handle new flags via reflection
- Remove setupSSHIntegration function and all references

Integrates SSH functionality into existing shell-integration-features
system for better consistency and user control.
</pre>
</div>
</content>
</entry>
<entry>
<title>feat: add SSH integration wrapper for shell integration</title>
<updated>2025-06-25T22:43:32+00:00</updated>
<author>
<name>Jason Rayne</name>
<email>yo@arcayne.dev</email>
</author>
<published>2025-06-13T23:11:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=142e07c502dfbb274892cd5aa640ade31264183d'/>
<id>142e07c502dfbb274892cd5aa640ade31264183d</id>
<content type='text'>
- Implements opt-in SSH wrapper following sudo pattern
- Supports term_only, basic, and full integration levels
- Fixes xterm-ghostty TERM compatibility on remote systems
- Propagates shell integration environment variables
- Allows for automatic installation of terminfo if desired
- Addresses GitHub discussions #5892 and #4156
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Implements opt-in SSH wrapper following sudo pattern
- Supports term_only, basic, and full integration levels
- Fixes xterm-ghostty TERM compatibility on remote systems
- Propagates shell integration environment variables
- Allows for automatic installation of terminfo if desired
- Addresses GitHub discussions #5892 and #4156
</pre>
</div>
</content>
</entry>
<entry>
<title>bash: explicitly request a login shell</title>
<updated>2025-05-05T14:26:37+00:00</updated>
<author>
<name>Jon Parise</name>
<email>jon@indelible.org</email>
</author>
<published>2025-05-02T11:42:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=37974dba06549ab714cbf36694e3439d9dbc9cf9'/>
<id>37974dba06549ab714cbf36694e3439d9dbc9cf9</id>
<content type='text'>
Prior to #7044, on macOS, our shell integrated command line would be
executed under `exec -l`, which caused bash to be started as a login
shell. Now that we're using direct command execution, add `--login` to
our bash command's arguments on macOS to get that same behavior.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Prior to #7044, on macOS, our shell integrated command line would be
executed under `exec -l`, which caused bash to be started as a login
shell. Now that we're using direct command execution, add `--login` to
our bash command's arguments on macOS to get that same behavior.
</pre>
</div>
</content>
</entry>
<entry>
<title>config: allow commands to specify whether they shell expand or not</title>
<updated>2025-04-10T20:15:14+00:00</updated>
<author>
<name>Mitchell Hashimoto</name>
<email>m@mitchellh.com</email>
</author>
<published>2025-04-05T15:45:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=722d41a359d71f251efab9135d1bef5837512352'/>
<id>722d41a359d71f251efab9135d1bef5837512352</id>
<content type='text'>
This introduces a syntax for `command` and `initial-command` that allows
the user to specify whether it should be run via `/bin/sh -c` or not.
The syntax is a prefix `direct:` or `shell:` prior to the command,
with no prefix implying a default behavior as documented.

Previously, we unconditionally ran commands via `/bin/sh -c`, primarily
to avoid having to do any shell expansion ourselves. We also leaned on
it as a crutch for PATH-expansion but this is an easy problem compared
to shell expansion.

For the principle of least surprise, this worked well for configurations
specified via the config file, and is still the default. However, these
configurations are also set via the `-e` special flag to the CLI, and it
is very much not the principle of least surprise to have the command run via
`/bin/sh -c` in that scenario since a shell has already expanded all the
arguments and given them to us in a nice separated format. But we had no
way to toggle this behavior.

This commit introduces the ability to do this, and changes the defaults
so that `-e` doesn't shell expand. Further, we also do PATH lookups
ourselves for the non-shell expanded case because thats easy (using
execvpe style extensions but implemented as part of the Zig stdlib). We don't
do path expansion (e.g. `~/`) because thats a shell expansion.

So to be clear, there are no two polar opposite behavioes here with
clear semantics:

  1. Direct commands are passed to `execvpe` directly, space separated.
     This will not handle quoted strings, environment variables, path
     expansion (e.g. `~/`), command expansion (e.g. `$()`), etc.

  2. Shell commands are passed to `/bin/sh -c` and will be shell expanded
     as per the shell's rules. This will handle everything that `sh`
     supports.

In doing this work, I also stumbled upon a variety of smaller
improvements that could be made:

  - A number of allocations have been removed from the startup path that
    only existed to add a null terminator to various strings. We now
    have null terminators from the beginning since we are almost always
    on a system that's going to need it anyways.

  - For bash shell integration, we no longer wrap the new bash command
    in a shell since we've formed a full parsed command line.

  - The process of creating the command to execute by termio is now unit
    tested, so we can test the various complex cases particularly on
    macOS of wrapping commands in the login command.

  - `xdg-terminal-exec` on Linux uses the `direct:` method by default
    since it is also assumed to be executed via a shell environment.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This introduces a syntax for `command` and `initial-command` that allows
the user to specify whether it should be run via `/bin/sh -c` or not.
The syntax is a prefix `direct:` or `shell:` prior to the command,
with no prefix implying a default behavior as documented.

Previously, we unconditionally ran commands via `/bin/sh -c`, primarily
to avoid having to do any shell expansion ourselves. We also leaned on
it as a crutch for PATH-expansion but this is an easy problem compared
to shell expansion.

For the principle of least surprise, this worked well for configurations
specified via the config file, and is still the default. However, these
configurations are also set via the `-e` special flag to the CLI, and it
is very much not the principle of least surprise to have the command run via
`/bin/sh -c` in that scenario since a shell has already expanded all the
arguments and given them to us in a nice separated format. But we had no
way to toggle this behavior.

This commit introduces the ability to do this, and changes the defaults
so that `-e` doesn't shell expand. Further, we also do PATH lookups
ourselves for the non-shell expanded case because thats easy (using
execvpe style extensions but implemented as part of the Zig stdlib). We don't
do path expansion (e.g. `~/`) because thats a shell expansion.

So to be clear, there are no two polar opposite behavioes here with
clear semantics:

  1. Direct commands are passed to `execvpe` directly, space separated.
     This will not handle quoted strings, environment variables, path
     expansion (e.g. `~/`), command expansion (e.g. `$()`), etc.

  2. Shell commands are passed to `/bin/sh -c` and will be shell expanded
     as per the shell's rules. This will handle everything that `sh`
     supports.

In doing this work, I also stumbled upon a variety of smaller
improvements that could be made:

  - A number of allocations have been removed from the startup path that
    only existed to add a null terminator to various strings. We now
    have null terminators from the beginning since we are almost always
    on a system that's going to need it anyways.

  - For bash shell integration, we no longer wrap the new bash command
    in a shell since we've formed a full parsed command line.

  - The process of creating the command to execute by termio is now unit
    tested, so we can test the various complex cases particularly on
    macOS of wrapping commands in the login command.

  - `xdg-terminal-exec` on Linux uses the `direct:` method by default
    since it is also assumed to be executed via a shell environment.
</pre>
</div>
</content>
</entry>
</feed>
