Cleanup PiscalSshClient ending newlines
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.IO;
|
||||
@@ -19,7 +18,7 @@ namespace LeafWeb.Core.Remote
|
||||
private const string StatusRunning = "running";
|
||||
private const string StatusNotStarted = "not started";
|
||||
|
||||
Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public PiscalSshClient(string connectionString)
|
||||
{
|
||||
@@ -81,9 +80,9 @@ namespace LeafWeb.Core.Remote
|
||||
ssh.Disconnect();
|
||||
|
||||
if (command.ExitStatus != 0)
|
||||
throw new PiscalClientException(leafInput.LeafInputId, command.Result);
|
||||
throw new PiscalClientException(leafInput.LeafInputId, command.Result.TrimEndNewLine());
|
||||
|
||||
_logger.Debug("RunLeafInput result: " + command.Result);
|
||||
_logger.Debug("RunLeafInput result: " + command.Result.TrimEndNewLine());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +114,7 @@ namespace LeafWeb.Core.Remote
|
||||
ssh.Disconnect();
|
||||
|
||||
if (command.ExitStatus != 0)
|
||||
throw new PiscalClientException(leafInput.LeafInputId, command.Result);
|
||||
throw new PiscalClientException(leafInput.LeafInputId, command.Result.TrimEndNewLine());
|
||||
|
||||
return command.Result
|
||||
.SplitNewLine()
|
||||
@@ -169,7 +168,7 @@ namespace LeafWeb.Core.Remote
|
||||
ssh.Disconnect();
|
||||
|
||||
if (command.ExitStatus != 0)
|
||||
throw new PiscalClientException(leafInput.LeafInputId, command.Error);
|
||||
throw new PiscalClientException(leafInput.LeafInputId, command.Error.TrimEndNewLine());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,11 @@ namespace LeafWeb.Core.Utility
|
||||
return Regex.Replace(path, @".*/([^/]*$)", "$1");
|
||||
}
|
||||
|
||||
public static string TrimEndNewLine(this string input)
|
||||
{
|
||||
return input.TrimEnd('\r', '\n');
|
||||
}
|
||||
|
||||
public static string Join<T>(this IEnumerable<T> enumerable, string separator)
|
||||
{
|
||||
return string.Join(separator, enumerable);
|
||||
|
||||
@@ -101,6 +101,7 @@ namespace LeafWeb.Web.Controllers
|
||||
}
|
||||
|
||||
// Callback from Piscal
|
||||
[ActionLog]
|
||||
public void NotifyComplete()
|
||||
{
|
||||
HangfireStartup.TriggerPiscalProcessQueue();
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace LeafWeb.Web.Services.PiscalQueue
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: clear any stalled processes
|
||||
private void ClearStalled()
|
||||
{
|
||||
var leafInputs =
|
||||
|
||||
Reference in New Issue
Block a user