diff options
| author | JP Dillingham <jp@dillingham.me> | 2025-02-17 14:16:08 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2025-02-17 14:16:08 -0600 |
| commit | 97b7e5cbf0bf717fedc1d52f1a2a6e1a462f87f4 (patch) | |
| tree | cd0ac6a5a95d165dcd3f6536ba6d8dec545807e5 /src/slskd/Integrations | |
| parent | 03265e1a8429adfb0d087f87570aa46dcaa15075 (diff) | |
| download | slskd-97b7e5cbf0bf717fedc1d52f1a2a6e1a462f87f4.tar.gz | |
negotiate exe and args
Diffstat (limited to 'src/slskd/Integrations')
| -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)) { |
