(Maint) Whitespace cleanup

Change to 2 space indentation and strip trailing whitespace
(MODULES-447) Retry shutdown abort command

Windows does not have an API for determining if a shutdown is currently in
progress. Instead you can try to abort any in progress shutdown, and if the
command (shutdown /a) returns 0, then it means a shutdown was successfully
aborted, or it will return 1116, which means no shutdown was in progress.

Note due to a ruby bug[1], it truncates exit code 1116 to a single byte,
resulting in 92.

However, puppet executes the watcher process asynchronously, so it was
possible for the acceptance test to issue the abort shutdown command
before the watcher process had initiated the shutdown. The tests tried
to work around this by sleeping for 5 seconds, but this doesn't work
on slow systems in CI.

This commit adds a helper method for retrying the shutdown abort command
and updates the various acceptance tests to use it. It also adds a
helper method for the opposite case, when verifying that a shutdown has
NOT been initiated.

[1] https://bugs.ruby-lang.org/issues/8083
(MODULES-447) Handle race when puppet has already exited

Previously, if the watcher called OpenProcess and it failed, we couldn't open
a handle to the puppet process, and would treat that as a fatal error.

However, if puppet exits before the watcher process called OpenProcess, then
the watcher would never reboot the system.

This commit checks to see if OpenProcess fails and GetLastError returns 87
(INVALID_PARAMTER). If so, then it means the pid no longer exists. And we can
conclude that puppet has already exited.

However, if OpenProcess fails for some other reason, e.g. access denied, then
we continue to treat that as a fatal error.
(MODULES-447) Don't write to stderr from the watcher

Previously, the watcher was writing the shutdown command to $stderr just
before executing the command. However, if the puppet process had already
exited, then the call to $stderr.puts will raise an exception when
executed via cygwin, and the shutdown would never happen.

The exception message reported: Invalid argument - <STDERR>. Also the
exception wasn't being caught, instead the watcher would silently exit.

Note this issue is timing dependent, since everything works out ok if puppet
is still running when the watcher writes the shutdown command to $stderr.

This commit adds exception handling around the watcher, and changes the
watcher to write to a temp file. Also some of the acceptance tests rely
on parsing the shutdown command that the watcher is going to execute. I
moved this into the provider itself.

One acceptance test had to be modified so that it doesn't try to match
the timeout message, since the watcher no longer writes to $stderr.