debug: add workflow to test timeout mechanism on Windows #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Debug Windows PowerShell | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - rt-protect-from-inkscape-errors | |
| jobs: | |
| test-powershell-delays: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Test PowerShell Start-Sleep | |
| shell: powershell | |
| run: | | |
| Write-Host "Testing PowerShell Start-Sleep -Seconds 5" | |
| $start = Get-Date | |
| powershell -Command "Start-Sleep -Seconds 5" | |
| $end = Get-Date | |
| $duration = ($end - $start).TotalSeconds | |
| Write-Host "Duration: $duration seconds" | |
| - name: Test PowerShell Start-Sleep (alternative syntax) | |
| shell: powershell | |
| run: | | |
| Write-Host "Testing Start-Sleep directly" | |
| $start = Get-Date | |
| Start-Sleep -Seconds 5 | |
| $end = Get-Date | |
| $duration = ($end - $start).TotalSeconds | |
| Write-Host "Duration: $duration seconds" | |
| - name: Test ping delay | |
| shell: powershell | |
| run: | | |
| Write-Host "Testing ping 127.0.0.1 -n 6" | |
| $start = Get-Date | |
| ping 127.0.0.1 -n 6 | |
| $end = Get-Date | |
| $duration = ($end - $start).TotalSeconds | |
| Write-Host "Duration: $duration seconds" | |
| - name: Test timeout command | |
| shell: cmd | |
| run: | | |
| echo Testing timeout command | |
| echo Start time: %time% | |
| timeout /t 5 /nobreak | |
| echo End time: %time% | |
| - name: Test PowerShell timeout with Ruby spawn | |
| shell: powershell | |
| run: | | |
| Write-Host "Testing Ruby spawn with PowerShell Start-Sleep" | |
| ruby -e "require 'timeout'; start = Time.now; begin; Timeout.timeout(2) { system('powershell', '-Command', 'Start-Sleep -Seconds 10') }; rescue Timeout::Error; puts 'Timed out as expected'; end; puts \"Duration: #{Time.now - start} seconds\"" | |
| - name: Test ping with Ruby spawn | |
| shell: powershell | |
| run: | | |
| Write-Host "Testing Ruby spawn with ping" | |
| ruby -e "require 'timeout'; start = Time.now; begin; Timeout.timeout(2) { system('ping', '127.0.0.1', '-n', '11') }; rescue Timeout::Error; puts 'Timed out as expected'; end; puts \"Duration: #{Time.now - start} seconds\"" | |
| - name: Test PowerShell -NoProfile -NonInteractive | |
| shell: powershell | |
| run: | | |
| Write-Host "Testing PowerShell with -NoProfile -NonInteractive" | |
| $start = Get-Date | |
| powershell -NoProfile -NonInteractive -Command "Start-Sleep -Seconds 5" | |
| $end = Get-Date | |
| $duration = ($end - $start).TotalSeconds | |
| Write-Host "Duration: $duration seconds" | |
| - name: Test Ruby Process.spawn with timeout | |
| shell: powershell | |
| run: | | |
| Write-Host "Testing Process.spawn with timeout using PowerShell" | |
| ruby -e "require 'timeout'; pid = Process.spawn('powershell', '-Command', 'Start-Sleep -Seconds 10'); start = Time.now; begin; Timeout.timeout(2) { Process.wait(pid) }; rescue Timeout::Error; Process.kill('KILL', pid); puts 'Killed process after timeout'; end; puts \"Duration: #{Time.now - start} seconds\"" | |
| - name: Test Ruby Process.spawn with ping | |
| shell: powershell | |
| run: | | |
| Write-Host "Testing Process.spawn with ping" | |
| ruby -e "require 'timeout'; pid = Process.spawn('ping', '127.0.0.1', '-n', '11'); start = Time.now; begin; Timeout.timeout(2) { Process.wait(pid) }; rescue Timeout::Error; Process.kill('KILL', pid); puts 'Killed process after timeout'; end; puts \"Duration: #{Time.now - start} seconds\"" |