From f15487046ab14c0de4ab2562a02dd9467b54703f Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 20 Jul 2022 21:39:41 -0500 Subject: chmod bin on linux/mac --- src/slskd/Common/Dumper.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/slskd/Common/Dumper.cs b/src/slskd/Common/Dumper.cs index da6ec06c..766fe803 100644 --- a/src/slskd/Common/Dumper.cs +++ b/src/slskd/Common/Dumper.cs @@ -69,7 +69,12 @@ namespace slskd await Download(url, BinFile); - await ExecAsync(BinFile, Environment.ProcessId, outputFile); + if (!OperatingSystem.IsWindows()) + { + await ExecAsync("/bin/sh", $"-c \"chmod +x {BinFile}\""); + } + + await ExecAsync(BinFile, $"collect --process-id {Environment.ProcessId} --type full --output {outputFile}"); return outputFile; } @@ -97,11 +102,11 @@ namespace slskd await remoteStream.CopyToAsync(localStream); } - private async Task ExecAsync(string bin, int pid, string output) + private async Task ExecAsync(string bin, string args) { using var process = new Process(); process.StartInfo.FileName = bin; - process.StartInfo.Arguments = $"collect --process-id {pid} --type full --output {output}"; + process.StartInfo.Arguments = args; process.Start(); await process.WaitForExitAsync(); } -- cgit v1.2.3