Skip to content

Commit e239674

Browse files
authored
Merge pull request #165 from Azure/satimPyVersionChange
change python version check order in shim and handler
2 parents 62ef959 + 1fdca53 commit e239674

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/extension/src/MsftLinuxPatchExtShim.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function find_python(){
3636
local python_exec_command=$1
3737

3838
# Check if there is python defined.
39-
for p in python python2 python3 /usr/libexec/platform-python; do
39+
for p in python3 python python2 /usr/libexec/platform-python; do
4040
if command -v "${p}" ; then
4141
eval ${python_exec_command}=${p}
4242
return

src/extension/src/ProcessHandler.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,16 @@ def get_python_cmd(self):
132132
command_to_use_for_python = "python"
133133
command_to_use_for_python3 = "python3"
134134

135-
# check if the machine contains python
136-
code_returned_for_python_check, output_for_python_check = self.env_layer.run_command_output(command_to_check_for_python, False, False)
137-
if code_returned_for_python_check == 0 and command_to_use_for_python in str(output_for_python_check) and command_to_use_for_python3 not in str(output_for_python_check):
138-
return command_to_use_for_python
139-
140135
# check if the machine contains python3
141136
code_returned_for_python3_check, output_for_python3_check = self.env_layer.run_command_output(command_to_check_for_python3, False, False)
142137
if code_returned_for_python3_check == 0 and command_to_use_for_python3 in str(output_for_python3_check):
143138
return command_to_use_for_python3
144139

140+
# check if the machine contains python
141+
code_returned_for_python_check, output_for_python_check = self.env_layer.run_command_output(command_to_check_for_python, False, False)
142+
if code_returned_for_python_check == 0 and command_to_use_for_python in str(output_for_python_check) and command_to_use_for_python3 not in str(output_for_python_check):
143+
return command_to_use_for_python
144+
145145
return Constants.PYTHON_NOT_FOUND
146146

147147
def __check_process_state(self, process, seq_no):

0 commit comments

Comments
 (0)