File size: 469 Bytes
8c763fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/expect -f

exp_internal 1

# Expects path to PowerShell as first argument
set powershell [lindex $argv 0]

set timeout 60

spawn $powershell -nologo -noprofile -command Read-Host prompt

expect  {
    "prompt: $" { send "input\r" ; exp_continue }
    "input\r\ninput\r" { exit 2 }
    "input\r\n" { exit 0 }
}

# ExitCode: 2 -- this is the old, incorrect behavior
# ExitCode: 0 -- this is the expected behavior
# ExitCode: 1 -- anything else is wrong
exit 1