From 97b7e5cbf0bf717fedc1d52f1a2a6e1a462f87f4 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 17 Feb 2025 14:16:08 -0600 Subject: negotiate exe and args --- src/slskd/Integrations/Scripts/ScriptService.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/slskd/Integrations/Scripts') diff --git a/src/slskd/Integrations/Scripts/ScriptService.cs b/src/slskd/Integrations/Scripts/ScriptService.cs index 091ea05d..48b7484a 100644 --- a/src/slskd/Integrations/Scripts/ScriptService.cs +++ b/src/slskd/Integrations/Scripts/ScriptService.cs @@ -88,8 +88,21 @@ public class ScriptService try { var run = script.Value.Run; - string executable = run.Executable ?? DefaultExecutable; - string args = run.Command; + string executable = default; + string args = default; + + // 'command mode' takes precedence over 'executable' mode + // run the system shell and ensure the specified command is prefixed with the correct flag + if (!string.IsNullOrEmpty(run.Command)) + { + executable = DefaultExecutable; + args = run.Command.StartsWith(DefaultCommandPrefix) ? run.Command : $"{DefaultCommandPrefix} {run.Command}"; + } + else + { + executable = run.Executable ?? DefaultExecutable; + args = run.Args; + } if (string.IsNullOrEmpty(executable)) { -- cgit v1.2.3