У меня есть консольное приложение ядра .NET и я пытаюсь выполнить команды PS из него.Следующий код корректно работает на машине с Windows, но застревает на машине с Linux (Ubuntu).
var pipeLine = _runspace.CreatePipeline();
var myCommand = new Command(script, true);
pipeLine.Commands.Add(myCommand);
pipeLine.Input.Close();
Console.WriteLine("Running pipeline...");
pipeLine.InvokeAsync();
while (pipeLine.PipelineStateInfo.State != PipelineState.Completed)
{
Thread.Sleep(100);
Console.WriteLine(pipeLine.PipelineStateInfo.State.ToString());//Status is still 'Running' infinitely on linux machine
}
System.Console.WriteLine("PipeLine finished");
while (!pipeLine.Output.EndOfPipeline)
commandResults.Add(pipeLine.Output.Read());
Обе машины имеют одинаковую версию ядра .NET.
Есть идеи?