Kill POSIX crap in Win32 execute_shell_for_output

Reporter: time-killer-games  |  Status: closed  |  Last Modified: September 14, 2019, 08:58:16 PM

I also intend to rewrite fileio.cpp for Win32 that doesn't use POSIX API calls and supports UTF-8, in a different pr.

show_message(execute_shell_for_output('cmd /c dir c:\'));

Capture

time-killer-games  
@JoshDreamland ready for review.
codecov[bot]  

Codecov Report

❗️ No coverage uploaded for pull request base (master@0da40cf). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1811   +/-   ##
=========================================
  Coverage          ?   25.15%           
=========================================
  Files             ?      177           
  Lines             ?    16844           
  Branches          ?        0           
=========================================
  Hits              ?     4237           
  Misses            ?    12607           
  Partials          ?        0

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0da40cf...bbc614c. Read the comment docs.

time-killer-games  

@JoshDreamland Note for review: the Posix version of execute_shell_for_output() will always return a new line at the end of the string no matter what. To adopt the same behavior, I did the Windows equivalent by checking the function for failure scenarios, and under those conditions, return a carriage return and new line instead of an empty string, so that new line will always be at the end of the string regardless, just as the Posix function does, (however there are no conditions the Posix function will fail, as even an invalid argument specified will output a lone new line character for the return string). I just wanted to explain why I did that; no reason other than consistency.
time-killer-games  

@JoshDreamland Now passing! Review when you can and thank you! :D
JoshDreamland  

Nicely done.
Please sign in to post comments, or you can view this issue on GitHub.