powershell - fix async for Ansible.Basic (#48404)

* powershell - fix async for Ansible.Basic

* moved old out outside of the try block
This commit is contained in:
Jordan Borean 2018-11-14 06:08:27 +10:00 committed by Matt Davis
parent 34fc66185e
commit 4fc013a7fa
2 changed files with 17 additions and 21 deletions

View file

@ -1228,14 +1228,7 @@ namespace Ansible.Basic
private static void WriteLineModule(string line)
{
// When running over psrp there may not be a console to write the
// line to, we check if there is a Console Window and fallback on
// setting a variable that the Ansible module_wrapper will check
// and output to the PowerShell Output stream on close.
if (GetConsoleWindow() != IntPtr.Zero)
Console.WriteLine(line);
else
ScriptBlock.Create("Set-Variable -Name _ansible_output -Value $args[0] -Scope Global").Invoke(line);
Console.WriteLine(line);
}
}
}