Skip to content

Commit 82fd9ca

Browse files
committed
feat: attribute on_windows? method to rubyworks-facets rbconfig
1 parent 56a4b81 commit 82fd9ca

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/pwsh/util.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ module Util
77
module_function
88

99
# Verifies whether or not the current context is running on a Windows node.
10+
# Implementation copied from `facets`: https://github.com/rubyworks/facets/blob/main/lib/standard/facets/rbconfig.rb
1011
#
1112
# @return [Bool] true if on windows
1213
def on_windows?
13-
# Ruby only sets File::ALT_SEPARATOR on Windows and the Ruby standard
14-
# library uses that to test what platform it's on.
15-
require 'rbconfig'
16-
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
17-
!!is_windows
14+
host_os = RbConfig::CONFIG['host_os']
15+
!!(host_os =~ /mswin|mingw/)
1816
end
1917

2018
# Verify paths specified are valid directories which exist.

0 commit comments

Comments
 (0)