From 959d5cb5d45d4a8927a014ae9a2cdfbf825e6699 Mon Sep 17 00:00:00 2001 From: Gustavo Parreira Date: Tue, 9 Dec 2025 18:23:20 +0000 Subject: [PATCH 1/4] fix: install mac games on macOS by default. kill child processes when freecarnival is killed --- launch/launch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch/launch.go b/launch/launch.go index a514543..50d4f7f 100644 --- a/launch/launch.go +++ b/launch/launch.go @@ -206,7 +206,7 @@ func launchWithWine(ctx context.Context, executablePath string, args []string, o } cmdArgs := append([]string{executablePath}, args...) - cmd := exec.Command(winePath, cmdArgs...) + cmd := exec.CommandContext(ctx, winePath, cmdArgs...) cmd.Dir = filepath.Dir(executablePath) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr From 741b192e3675b7691f6d10f3a9e6b0bfdb9e647f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 18:32:28 +0000 Subject: [PATCH 2/4] Initial plan From 621e76d8c6237081e400e103b53b57ce6573adcc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 18:39:16 +0000 Subject: [PATCH 3/4] fix: use errors.Is for context.Canceled checks across all files Co-authored-by: Gustash <8539174+Gustash@users.noreply.github.com> --- cmd_install.go | 3 ++- cmd_update.go | 3 ++- download/downloader.go | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd_install.go b/cmd_install.go index 286dfad..c2c4a8d 100644 --- a/cmd_install.go +++ b/cmd_install.go @@ -2,6 +2,7 @@ package main import ( "context" + "errors" "fmt" "os" "path/filepath" @@ -149,7 +150,7 @@ the latest version for the current OS will be used.`, err = downloader.Download(cmd.Context(), installPath, nil, nil) // Check if download was cancelled (Ctrl+C) - if err == context.Canceled { + if errors.Is(err, context.Canceled) { return nil // Exit cleanly without error } diff --git a/cmd_update.go b/cmd_update.go index 404daf8..98ad8f6 100644 --- a/cmd_update.go +++ b/cmd_update.go @@ -2,6 +2,7 @@ package main import ( "context" + "errors" "fmt" "github.com/gustash/freecarnival/auth" @@ -104,7 +105,7 @@ func newUpdateCmd() *cobra.Command { err = updater.Update(cmd.Context()) // Check if update was cancelled (Ctrl+C) - if err == context.Canceled { + if errors.Is(err, context.Canceled) { return nil // Exit cleanly without error } diff --git a/download/downloader.go b/download/downloader.go index 77fb2c3..84baecc 100644 --- a/download/downloader.go +++ b/download/downloader.go @@ -3,6 +3,7 @@ package download import ( "context" + "errors" "fmt" "net/http" "os" @@ -153,7 +154,7 @@ func (d *Downloader) Download(ctx context.Context, installPath string, buildMani err = d.downloadAndWrite(ctx, fileChunks, fileInfoMap, resumeState) - if ctx.Err() == context.Canceled { + if errors.Is(ctx.Err(), context.Canceled) { d.progress.Abort() logger.Info("\n\nDownload paused. Progress has been saved.") logger.Info("Run the same install command again to resume from where you left off.") @@ -457,7 +458,7 @@ func (d *Downloader) downloadWorker(ctx context.Context, downloader *ChunkDownlo data, err := downloader.Download(ctx, job.FileIndex, job.ChunkSHA) - if err == context.Canceled { + if errors.Is(err, context.Canceled) { d.memory.Release(manifest.MaxChunkSize) return } From 895a2ffc1eabc12f48f63feb1428288167a3602c Mon Sep 17 00:00:00 2001 From: Gustavo Parreira Date: Tue, 9 Dec 2025 19:21:48 +0000 Subject: [PATCH 4/4] fix: revert change --- launch/launch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch/launch.go b/launch/launch.go index 50d4f7f..a514543 100644 --- a/launch/launch.go +++ b/launch/launch.go @@ -206,7 +206,7 @@ func launchWithWine(ctx context.Context, executablePath string, args []string, o } cmdArgs := append([]string{executablePath}, args...) - cmd := exec.CommandContext(ctx, winePath, cmdArgs...) + cmd := exec.Command(winePath, cmdArgs...) cmd.Dir = filepath.Dir(executablePath) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr