Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions shell/AIShell.Kernel/Command/AgentCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,26 @@ private void ConfigAgentAction(string name, string editor)
else
{
// On macOS and Linux, we just depend on the default editor.
FileInfo fileInfo = new(settingFile);
if (fileInfo.Exists)
{
UnixFileMode curMode = fileInfo.UnixFileMode;
UnixFileMode newMode = curMode & ~(UnixFileMode.UserExecute | UnixFileMode.GroupExecute | UnixFileMode.OtherExecute);

if (newMode != curMode)
{
try
{
File.SetUnixFileMode(settingFile, newMode);
}
catch (UnauthorizedAccessException)
{
host.WriteErrorLine($"The setting file '{settingFile}' is incorrectly configured with the 'execute' permission. Please remove the 'execute' permission and try again.");
return;
}
}
}

info = new(settingFile) { UseShellExecute = true };
Process.Start(info);
}
Expand Down
Loading