Fix issue 10198: edit-in-kitty exits with editor's exit code

- Python (kitty/launch.py): Track editor PID via monitor_pid to capture
  exit code when editor window closes. Send exit code as data in the DONE
  message instead of sending no data.
- Go (tools/cmd/edit_in_kitty/main.go): Parse exit code from DONE message
  data and use lp.Quit(exit_code) to exit with the editor's exit code.
- Go (tools/cmd/tool/confirm_and_run_shebang.go): Check exit code when
  running edit-in-kitty as a subprocess; abort execution on editor failure.
This commit is contained in:
copilot-swe-agent[bot]
2026-06-28 03:10:58 +00:00
committed by GitHub
parent cd88eb3915
commit aee532c586
3 changed files with 47 additions and 18 deletions

View File

@@ -4,6 +4,7 @@ package tool
import (
"bufio"
"errors"
"fmt"
"os"
"os/exec"
@@ -120,7 +121,13 @@ func confirm_and_run_shebang(args []string, confirm_policy ConfirmPolicy) (rc in
editor.Stdin = os.Stdin
editor.Stdout = os.Stdout
editor.Stderr = os.Stderr
editor.Run()
if err = editor.Run(); err != nil {
var exitErr *exec.ExitError
if errors.As(err, &exitErr) {
return exitErr.ExitCode(), nil
}
return 1, err
}
return confirm_and_run_shebang(args, ConfirmIfNeeded)
case "y":
}