Skip to content

Commit

Permalink
Merge pull request #195 from golemfactory/fix-cert-path-with-spaces
Browse files Browse the repository at this point in the history
Fix issues related to cert path containing spaces
  • Loading branch information
nieznanysprawiciel authored Aug 8, 2024
2 parents b2b80c0 + f140df4 commit 377eeb6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Golem/Yagna/ProcessFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,14 @@ public string ExecToText(IEnumerable<object> args)
catch (Exception e)
{
Logger?.LogError(e, "Failed to execute cmd. Args: {0}", args);
throw new GolemProcessException(string.Format("Failed to execute command: {0} {1}", Executable, e.Message));
throw new GolemProcessException(string.Format("Failed to execute command: {0} {1}, {2}", Executable, String.Join(" ", args.ToArray()), e.Message));
}
if (process.HasExited && process.ExitCode!=0)
throw new GolemProcessException(string.Format("Failed to execute command: {0}, error code: {1}, stderr: {2}", Executable, process.ExitCode, stdError));
if (process.HasExited && process.ExitCode != 0)
{
throw new GolemProcessException(string.Format("Failed to execute command: {0} {1}, error code: {2}, stderr: {3}", Executable, String.Join(" ", args.ToArray()), process.ExitCode, stdError));
}


return stdOutput;
}

Expand Down
4 changes: 3 additions & 1 deletion Golem/Yagna/ProviderRulesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public List<string> Certificates

public string AddCertificate(string certPath)
{
var args = $"rule add {GetRuleCommand()} certified import-cert {certPath}".Split().ToList();
var args = $"rule add {GetRuleCommand()} certified import-cert".Split().ToList();
// Path can contains spaces, so we need to add it as separate argument.
args.Add(certPath);
return _provider.ExecToText(args);
}

Expand Down

0 comments on commit 377eeb6

Please sign in to comment.