Replace /dev/null with NUL on Windows; Handle shell echo quotes #365

Merged
merged 1 commit into from Nov 21, 2012

Conversation

Projects
None yet
4 participants
@cablegram
Contributor

cablegram commented Nov 21, 2012

  • Replace use of '/dev/null' with DEV_NULL, a constant that is evaluated at load time. This snippet for identifying Windows and calculating the null device name is copied from bundler (see https://github.com/carlhuda/bundler/blob/054329690071974180393a4f14ec3fa2984bc446/lib/bundler.rb#L65-67)
  • Handle the case where quotes in the argument of an echo command may or may not be included in the result depending on OS. On Windows, the shell command "ECHO 'a'" returns "'a'" (with quotes). On Linux, the shell command "ECHO 'a'" returns "a" (without quotes).
Replace /dev/null with NUL on Windows; Handle shell echo command retu…
…rning quotes

* Replace use of '/dev/null' with DEV_NULL, a constant that is evaluated at load time. This snippet for identifying Windows and calculating the null device name is copied from bundler (see https://github.com/carlhuda/bundler/blob/054329690071974180393a4f14ec3fa2984bc446/lib/bundler.rb#L65-67)
* Handle the case where quotes in the argument of an echo command may or may not be included in the result depending on OS. On Windows, the shell command "ECHO 'a'" returns "'a'" (with quotes). On Linux, the shell command "ECHO 'a'" returns "a" (without quotes).
@thibaudgg

This comment has been minimized.

Show comment Hide comment
@thibaudgg

thibaudgg Nov 21, 2012

Owner

Sounds good to me, @guard/core-team ok?

Owner

thibaudgg commented Nov 21, 2012

Sounds good to me, @guard/core-team ok?

@rymai

This comment has been minimized.

Show comment Hide comment
@rymai

rymai Nov 21, 2012

Owner

Yep, seems good, thanks!

Owner

rymai commented Nov 21, 2012

Yep, seems good, thanks!

@netzpirat

This comment has been minimized.

Show comment Hide comment
@netzpirat

netzpirat Nov 21, 2012

Contributor

👍

Contributor

netzpirat commented Nov 21, 2012

👍

netzpirat added a commit that referenced this pull request Nov 21, 2012

Merge pull request #365 from cablegram/no_dev_null_on_windows
Replace /dev/null with NUL on Windows; Handle shell echo quotes

@netzpirat netzpirat merged commit 6681c95 into guard:master Nov 21, 2012

1 check passed

default The Travis build passed
Details

cablegram added a commit to cablegram/guard-rails that referenced this pull request Jun 19, 2013

Windows fixes: Setting environment variables in command line; Redirec…
…ting to null device

* On Windows platforms, calls to Kernel#system issues commands to Windows Command Interpreter (cmd.exe). Windows Command Interpreter does not support setting of environment variables at the beginning of a command. This pull request moves the setting of environment variables inside the command string passed to sh where environment variables are processed as expected.

* Replace use of '/dev/null' with Guard::DEV_NULL, a constant that is evaluated at load time Guard is loaded (see guard/guard#365). The constant is set 'NUL' on Windows to '/dev/null' on other platforms.

cablegram added a commit to cablegram/guard-rails that referenced this pull request Jun 20, 2013

Windows fixes: Setting environment variables in command line; Redirec…
…ting to null device

* On Windows platforms, calls to Kernel#system issues commands to Windows Command Interpreter (cmd.exe). Windows Command Interpreter does not support setting of environment variables at the beginning of a command. This pull request moves the setting of environment variables inside the command string passed to sh where environment variables are processed as expected.

* Replace use of '/dev/null' with Guard::DEV_NULL, a constant that is evaluated at load time Guard is loaded (see guard/guard#365). The constant is set 'NUL' on Windows to '/dev/null' on other platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment