mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
Fixed: Executing powershell and python scripts directly in Connect->Custom Scripts
This commit is contained in:
@@ -102,6 +102,54 @@ namespace NzbDrone.Common.Test
|
||||
Subject.Exists(DummyApp.DUMMY_PROCCESS_NAME).Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Should_be_able_to_start_powershell()
|
||||
{
|
||||
WindowsOnly();
|
||||
|
||||
var tempDir = GetTempFilePath();
|
||||
var tempScript = Path.Combine(tempDir, "myscript.ps1");
|
||||
|
||||
Directory.CreateDirectory(tempDir);
|
||||
|
||||
File.WriteAllText(tempScript, "Write-Output 'Hello There'\r\n");
|
||||
|
||||
try
|
||||
{
|
||||
var result = Subject.StartAndCapture(tempScript);
|
||||
|
||||
result.Standard.First().Content.Should().Be("Hello There");
|
||||
}
|
||||
catch (Win32Exception ex) when (ex.NativeErrorCode == 2)
|
||||
{
|
||||
Assert.Fail("No Powershell available?!?");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Should_be_able_to_start_python()
|
||||
{
|
||||
WindowsOnly();
|
||||
|
||||
var tempDir = GetTempFilePath();
|
||||
var tempScript = Path.Combine(tempDir, "myscript.py");
|
||||
|
||||
Directory.CreateDirectory(tempDir);
|
||||
|
||||
File.WriteAllText(tempScript, "print(\"Hello There\")\r\n");
|
||||
|
||||
try
|
||||
{
|
||||
var result = Subject.StartAndCapture(tempScript);
|
||||
|
||||
result.Standard.First().Content.Should().Be("Hello There");
|
||||
}
|
||||
catch (Win32Exception ex) when (ex.NativeErrorCode == 2)
|
||||
{
|
||||
Assert.Inconclusive("No Python available");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Platform(Exclude = "MacOsX")]
|
||||
[Retry(3)]
|
||||
|
||||
Reference in New Issue
Block a user