File tree 1 file changed +25
-1
lines changed
1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -74,9 +74,30 @@ def env
74
74
end
75
75
76
76
def env_var ( name )
77
+ windows_platform? ? "%#{ name } %" : "$#{ name } "
78
+ end
77
79
80
+ def windows_platform?
81
+ # Check if on Windows via RUBY_PLATFORM (CRuby) and RUBY_DESCRIPTION (JRuby)
82
+ win_platform_regex = /mingw|mswin/
83
+ RUBY_PLATFORM =~ win_platform_regex || RUBY_DESCRIPTION =~ win_platform_regex
78
84
end
85
+
79
86
def command ( cmd )
87
+ puts '-' * 80
88
+ puts "Running: #{ cmd } "
89
+ puts '-' * 10
90
+ output , status = Open3 . capture2e ( "#{ cmd } 2>&1" )
91
+ puts output
92
+ puts '-' * 10
93
+ pp status
94
+ puts '-' * 80
95
+ puts
96
+
97
+ exit 1 unless status . success?
98
+ end
99
+
100
+ def command_with_env ( env , cmd )
80
101
puts '-' * 80
81
102
puts "Running: #{ cmd } "
82
103
puts '-' * 10
@@ -106,7 +127,10 @@ def work_tree
106
127
end
107
128
108
129
def test_command_with_env
109
-
130
+ command_with_env (
131
+ { 'PATH' => 'testing' } ,
132
+ %Q(echo "#{ env_var ( 'PATH' ) } " 2>&1)
133
+ )
110
134
end
111
135
112
136
def test_octopus_merge
You can’t perform that action at this time.
0 commit comments