Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2450 from janbiedermann/windows_performance_compare
Windows performance:compare
- Loading branch information
Showing
8 changed files
with
128 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# frozen_string_literal: true | ||
|
||
module Opal | ||
module OS | ||
module_function | ||
|
||
def windows? | ||
/bccwin|cygwin|djgpp|mingw|mswin|wince/.match?(RbConfig::CONFIG['host_os']) | ||
end | ||
|
||
def macos? | ||
/darwin|mac os/.match?(RbConfig::CONFIG['host_os']) | ||
end | ||
|
||
def shellescape(str) | ||
if windows? | ||
'"' + str.gsub('"', '""') + '"' | ||
else | ||
str.shellescape | ||
end | ||
end | ||
|
||
def env_sep | ||
windows? ? ';' : ':' | ||
end | ||
|
||
def path_sep | ||
windows? ? '\\' : '/' | ||
end | ||
|
||
def cmd_sep | ||
windows? ? ' & ' : ' ; ' | ||
end | ||
|
||
def dev_null | ||
windows? ? 'NUL' : '/dev/null' | ||
end | ||
|
||
def bash_c(*commands) | ||
cmd = if windows? | ||
[ | ||
'bundle', | ||
'exec', | ||
'cmd', | ||
'/c', | ||
] | ||
else | ||
[ | ||
'bundle', | ||
'exec', | ||
'bash', | ||
'-c', | ||
] | ||
end | ||
|
||
cmd << commands.join(cmd_sep) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters