File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -120,20 +120,25 @@ def binary
120
120
@binary ||= which ( @command )
121
121
end
122
122
123
- def locate_executable ( cmd )
124
- if ExecJS . windows? && File . extname ( cmd ) == ""
125
- cmd << ".exe"
126
- end
127
-
128
- if File . executable? cmd
129
- cmd
130
- else
131
- path = ENV [ 'PATH' ] . split ( File ::PATH_SEPARATOR ) . find { |p |
132
- full_path = File . join ( p , cmd )
133
- File . executable? ( full_path ) && File . file? ( full_path )
123
+ def locate_executable ( command )
124
+ commands = Array ( command )
125
+ if ExecJS . windows? && File . extname ( command ) == ""
126
+ ENV [ 'PATHEXT' ] . split ( File ::PATH_SEPARATOR ) . each { |p |
127
+ commands << ( command + p )
134
128
}
135
- path && File . expand_path ( cmd , path )
136
129
end
130
+
131
+ commands . find { |cmd |
132
+ if File . executable? cmd
133
+ cmd
134
+ else
135
+ path = ENV [ 'PATH' ] . split ( File ::PATH_SEPARATOR ) . find { |p |
136
+ full_path = File . join ( p , cmd )
137
+ File . executable? ( full_path ) && File . file? ( full_path )
138
+ }
139
+ path && File . expand_path ( cmd , path )
140
+ end
141
+ }
137
142
end
138
143
139
144
protected
You can’t perform that action at this time.
0 commit comments