Reliably handle issuing shutdown command via remote shell
In a test suite run we had this:
13:40:45 And I shutdown Tails and wait for the computer to power off # features/step_definitions/common_steps.rb:853
13:40:45 end of file reached (EOFError)
13:40:45 ./features/support/helpers/remote_shell.rb:62:in `readline'
13:40:45 ./features/support/helpers/remote_shell.rb:62:in `block (2 levels) in communicate'
13:40:45 ./features/support/helpers/remote_shell.rb:40:in `loop'
13:40:45 ./features/support/helpers/remote_shell.rb:40:in `block in communicate'
13:40:45 ./features/support/helpers/remote_shell.rb:37:in `communicate'
13:40:45 ./features/support/helpers/remote_shell.rb:120:in `execute'
13:40:45 ./features/support/helpers/remote_shell.rb:131:in `initialize'
13:40:45 ./features/support/helpers/vm_helper.rb:445:in `new'
13:40:45 ./features/support/helpers/vm_helper.rb:445:in `execute'
13:40:45 ./features/support/helpers/vm_helper.rb:460:in `spawn'
13:40:45 ./features/step_definitions/common_steps.rb:854:in `/^I shutdown Tails and wait for the computer to power off$/'
The code that fails is:
$vm.spawn('systemctl poweroff')
I think what happens is that the system power off process manages to kill the remote shell before it sends the ACK that spawn command require. So it can probably be fixed with:
$vm.spawn('sleep 3; systemctl poweroff')
Alternatively, and perhaps preferably, we can remove the ACK for spawn.