puppetlabs/puppet — pull request #2068 by ferventcoder (2013-11-14 18:05:59+00:00)
Title: (#23124) Fix: Incorrect Exit Codes from Windows Exec

This fixes the incorrect exitstatus being returned when a process
is run on Windows. There is an outstanding bug with Ruby
(https://bugs.ruby-lang.org/issues/8083) where it truncates the
exit codes to one byte values. Due to this an exit code of 3010
is currently truncated to 194.

Puppet accurately receives the exit code but was then ignoring
that and only returning the output. $CHILD_STATUS was then being
queried, and due to the aforementioned bug, was returning the
truncated return code. This means that anything above 256 would
be returned incorrectly.

This removes the private method Puppet::Util::SUIDManager.run_and_capture()
in favor of a more simplified call to Puppet::Util::Execution.execute().
This was done as run_and_capture was only being called by
Puppet::Provider::Exec.run(). This also removes the call to $CHILD_STATUS
which may clear up some other race conditions with capturing the proper
$CHILD_STATUS.