mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 04:24:00 -07:00
win_wait_for: added module (#26556)
* win_wait_for: added module * Increased timeout on async task * added more debug messages for test debug * revert to using win_shell instead of win_command * rebased from master and updated copyright string * Updated metadata version * Capitalised start of short_description * disabled win_wait_for tests until async issues are solved
This commit is contained in:
parent
40ea448c7b
commit
9b7dbc78c3
6 changed files with 751 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$port = {{test_win_wait_for_port}}
|
||||
|
||||
$endpoint = New-Object -TypeName System.Net.IPEndPoint([System.Net.IPAddress]::Parse("0.0.0.0"), $port)
|
||||
$listener = New-Object -TypeName System.Net.Sockets.TcpListener($endpoint)
|
||||
$listener.Server.ReceiveTimeout = 3000
|
||||
$listener.Start()
|
||||
|
||||
try {
|
||||
while ($true) {
|
||||
if (-not $listener.Pending()) {
|
||||
Start-Sleep -Seconds 1
|
||||
} else {
|
||||
$client = $listener.AcceptTcpClient()
|
||||
$client.Close()
|
||||
break
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
$listener.Stop()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue