diff options
| -rw-r--r-- | src/slskd/Integrations/Scripts/ScriptService.cs | 17 |
1 files changed, 15 insertions, 2 deletions
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)) { |
