aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-07-20 21:47:31 -0500
committerGitHub <noreply@github.com>2022-07-20 21:47:31 -0500
commit220f81a5d7c563a4bd78b9374162f3eadeeed8d8 (patch)
treeed0658fdffaca2b963c9561b0c584527dc933b75 /src
parent24d4a67c49d9ea59c3c1f324996720fec353aa60 (diff)
parentf15487046ab14c0de4ab2562a02dd9467b54703f (diff)
downloadslskd-220f81a5d7c563a4bd78b9374162f3eadeeed8d8.tar.gz
Merge pull request #558 from slskd/chmod
Set executable flag on downloaded dotnet-dump executable
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Common/Dumper.cs11
1 files changed, 8 insertions, 3 deletions
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();
}