mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
core: disable shell integration for initial-command
When an initial command is provided (either via -e or from explicit configuration), disable shell integration. The assumption is that this command is rarely a shell, and injecting our shell integration into this command's environment (e.g. when 'shell-integration' is forced) can cause unexpected behavior.
This commit is contained in:
@ -507,11 +507,18 @@ pub fn init(
|
|||||||
.config_conditional_state = app.config_conditional_state,
|
.config_conditional_state = app.config_conditional_state,
|
||||||
};
|
};
|
||||||
|
|
||||||
// The command we're going to execute
|
// The command we're going to execute is either 'initial-command'
|
||||||
const command: ?[]const u8 = if (app.first)
|
// (from -e or explicit configuration) or 'command' (our shell or
|
||||||
config.@"initial-command" orelse config.command
|
// explicit configuration). Shell integration is disabled when
|
||||||
else
|
// we're using 'initial-command'.
|
||||||
config.command;
|
const command: ?[]const u8, const shell_integration: configpkg.Config.ShellIntegration = config: {
|
||||||
|
if (app.first) {
|
||||||
|
if (config.@"initial-command") |initial_command| {
|
||||||
|
break :config .{ initial_command, .none };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break :config .{ config.command, config.@"shell-integration" };
|
||||||
|
};
|
||||||
|
|
||||||
// Start our IO implementation
|
// Start our IO implementation
|
||||||
// This separate block ({}) is important because our errdefers must
|
// This separate block ({}) is important because our errdefers must
|
||||||
@ -520,7 +527,7 @@ pub fn init(
|
|||||||
// Initialize our IO backend
|
// Initialize our IO backend
|
||||||
var io_exec = try termio.Exec.init(alloc, .{
|
var io_exec = try termio.Exec.init(alloc, .{
|
||||||
.command = command,
|
.command = command,
|
||||||
.shell_integration = config.@"shell-integration",
|
.shell_integration = shell_integration,
|
||||||
.shell_integration_features = config.@"shell-integration-features",
|
.shell_integration_features = config.@"shell-integration-features",
|
||||||
.working_directory = config.@"working-directory",
|
.working_directory = config.@"working-directory",
|
||||||
.resources_dir = global_state.resources_dir,
|
.resources_dir = global_state.resources_dir,
|
||||||
|
Reference in New Issue
Block a user