INNER CODE UNIT · Go
run
umputun/ralphex · cmd/ralphex/main.go:231
func run(ctx context.Context, o opts) error {
// suppress ^C echo in terminal before setting up interrupt watcher
restoreTerminal := disableCtrlCEcho()
defer restoreTerminal()
// worktree cleanup function, populated after worktree creation.
// synchronized for safe access from the interrupt watcher goroutine.
wtCleanup := &worktreeCleanupFn{}
// print immediate feedback when context is canceled (Ctrl+C).
// returned cleanup ensures goroutine exits when run() returns, avoiding leaks in tests.
defer startInterruptWatcher(ctx, func() {
restoreTerminal()
wtCleanup.call()
})()
// validate conflicting flags
if err := validateFlags(o); err != nil {