Skip to content

Commit 9c18fcf

Browse files
committed
Issue10752 Be more robust when finding a PERL interpreter to build OpenSSL. Initial patch by Gabi Davar
1 parent 062fcac commit 9c18fcf

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

PCbuild/build_ssl.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# python.exe build_ssl.py Release Win32
2525

2626
import os, sys, re, shutil
27+
import subprocess
2728

2829
# Find all "foo.exe" files on the PATH.
2930
def find_all_on_path(filename, extras = None):
@@ -46,22 +47,21 @@ def find_all_on_path(filename, extras = None):
4647
# is available.
4748
def find_working_perl(perls):
4849
for perl in perls:
49-
fh = os.popen('"%s" -e "use Win32;"' % perl)
50-
fh.read()
51-
rc = fh.close()
52-
if rc:
50+
try:
51+
subprocess.check_output([perl, "-e", "use Win32;"])
52+
except subprocess.CalledProcessError:
5353
continue
54-
return perl
55-
print("Can not find a suitable PERL:")
54+
else:
55+
return perl
56+
5657
if perls:
57-
print(" the following perl interpreters were found:")
58+
print("The following perl interpreters were found:")
5859
for p in perls:
5960
print(" ", p)
6061
print(" None of these versions appear suitable for building OpenSSL")
6162
else:
62-
print(" NO perl interpreters were found on this machine at all!")
63+
print("NO perl interpreters were found on this machine at all!")
6364
print(" Please install ActivePerl and ensure it appears on your path")
64-
return None
6565

6666
# Fetch SSL directory from VC properties
6767
def get_ssl_dir():

0 commit comments

Comments
 (0)