From 06a7849bd93108a4f96427e26007494da276382b Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 22:14:44 -0500 Subject: fix missing arg in log --- src/slskd/Integrations/Scripts/ScriptService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/slskd/Integrations/Scripts') diff --git a/src/slskd/Integrations/Scripts/ScriptService.cs b/src/slskd/Integrations/Scripts/ScriptService.cs index 33ef0b9b..8fb0f74d 100644 --- a/src/slskd/Integrations/Scripts/ScriptService.cs +++ b/src/slskd/Integrations/Scripts/ScriptService.cs @@ -123,7 +123,7 @@ public class ScriptService if (string.IsNullOrEmpty(executable)) { - Log.Warning("Script '{Script}' will not be run: unable to determine script executable. Update the script configuration, or set your operating system's SHELL envar."); + Log.Warning("Script '{Script}' will not be run: unable to determine script executable. Update the script configuration, or set your operating system's SHELL envar.", script.Key); return; } -- cgit v1.2.3 From fe97cb3fcbfaf66374ea09527672a9444d3ef1da Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 27 Oct 2026 17:12:56 -0500 Subject: attach stderr and stdout before waiting for exit --- src/slskd/Integrations/Scripts/ScriptService.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/slskd/Integrations/Scripts') diff --git a/src/slskd/Integrations/Scripts/ScriptService.cs b/src/slskd/Integrations/Scripts/ScriptService.cs index 8fb0f74d..f3f0efde 100644 --- a/src/slskd/Integrations/Scripts/ScriptService.cs +++ b/src/slskd/Integrations/Scripts/ScriptService.cs @@ -108,7 +108,7 @@ public class ScriptService foreach (var script in scriptsTriggeredByThisEventType) { - _ = Task.Run(() => + _ = Task.Run(async () => { Process process = default; var processId = Guid.NewGuid(); @@ -202,17 +202,20 @@ public class ScriptService process.Start(); - process.WaitForExit(); + var errorTask = process.StandardError.ReadToEndAsync(); + var outputTask = process.StandardOutput.ReadToEndAsync(); + + await process.WaitForExitAsync(); sw.Stop(); - var error = process.StandardError.ReadToEnd(); + var error = await errorTask; if (!string.IsNullOrEmpty(error)) { throw new Exception($"STDERR: {Regex.Replace(error, @"\r\n?|\n", " ", RegexOptions.Compiled)}"); } - var result = process.StandardOutput.ReadToEnd(); + var result = await outputTask; var resultAsLines = result.Split(["\r\n", "\r", "\n"], StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); Log.Debug("Script '{Script}' ran successfully in {Duration}ms; output: {Output} (id: {ProcessId})", script.Key, sw.ElapsedMilliseconds, resultAsLines, processId); -- cgit v1.2.3