diff --git a/internal/torrent/hooks.go b/internal/torrent/hooks.go index 7a973a6..e7105df 100644 --- a/internal/torrent/hooks.go +++ b/internal/torrent/hooks.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "os/exec" + "runtime" "github.com/debridmediamanager/zurg/internal/config" "github.com/debridmediamanager/zurg/pkg/logutil" @@ -18,7 +19,15 @@ func (se *ScriptExecutor) Execute() (string, error) { if se.Script == "" { return "", nil } - cmd := exec.Command("/bin/sh", "-c", se.Script) + + var cmd *exec.Cmd + if runtime.GOOS == "windows" { + // For Windows, using PowerShell + cmd = exec.Command("powershell", "-Command", se.Script) + } else { + // For Unix-like systems + cmd = exec.Command("/bin/sh", "-c", se.Script) + } cmd.Args = append(cmd.Args, "zurg") cmd.Args = append(cmd.Args, se.Args...) var out bytes.Buffer