mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
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:
parent
34fc66185e
commit
4fc013a7fa
2 changed files with 17 additions and 21 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue