aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Integrations
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-02-17 14:16:08 -0600
committerJP Dillingham <jp@dillingham.me>2025-02-17 14:16:08 -0600
commit97b7e5cbf0bf717fedc1d52f1a2a6e1a462f87f4 (patch)
treecd0ac6a5a95d165dcd3f6536ba6d8dec545807e5 /src/slskd/Integrations
parent03265e1a8429adfb0d087f87570aa46dcaa15075 (diff)
downloadslskd-97b7e5cbf0bf717fedc1d52f1a2a6e1a462f87f4.tar.gz
negotiate exe and args
Diffstat (limited to 'src/slskd/Integrations')
-rw-r--r--src/slskd/Integrations/Scripts/ScriptService.cs17
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))
{