Support windows hooks with powershell
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user