File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
modules/post/multi/manage Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -216,13 +216,21 @@ def run
216216 # @return String/nil A string if a Python binary can be found, else nil.
217217 #
218218 def remote_python_binary
219+ return @remote_python_binary if defined? ( @remote_python_binary )
220+
219221 python_exists_regex = /Python (2|3)\. (\d )/
220- # We could cache these values
221- return 'python' if cmd_exec ( 'python -V 2>&1' ) =~ python_exists_regex
222- return 'python2' if cmd_exec ( 'python2 -V 2>&1' ) =~ python_exists_regex
223- return 'python3' if cmd_exec ( 'python3 -V 2>&1' ) =~ python_exists_regex
224222
225- nil
223+ if cmd_exec ( 'python3 -V 2>&1' ) =~ python_exists_regex
224+ @remote_python_binary = 'python3'
225+ elsif cmd_exec ( 'python -V 2>&1' ) =~ python_exists_regex
226+ @remote_python_binary = 'python'
227+ elsif cmd_exec ( 'python2 -V 2>&1' ) =~ python_exists_regex
228+ @remote_python_binary = 'python2'
229+ else
230+ @remote_python_binary = nil
231+ end
232+
233+ @remote_python_binary
226234 end
227235
228236 def transmit_payload ( exe , platform )
You can’t perform that action at this time.
0 commit comments