Fix #1059: Linking for mingw/x86_64 on MSYS2 fails, and optimize "ar" command execution

Command line length=8158 is the maximum to be OK.
Feiyun Wang 2023-04-04 19:54:14 +08:00
parent fb06503307
commit 64a818cfd9
1 changed files with 2 additions and 3 deletions

View File

@ -12,8 +12,7 @@ def configure(env):
def mySubProcess(cmdline, env): def mySubProcess(cmdline, env):
# print(cmdline) # print(cmdline)
proc = subprocess.run(args=cmdline, shell=True, env=env) rv = subprocess.run(args=cmdline, shell=True, env=env).returncode
rv = proc.returncode
if rv: if rv:
print("=====") print("=====")
print("subprocess.run().returncode=", rv, "(", hex(rv), ")") print("subprocess.run().returncode=", rv, "(", hex(rv), ")")
@ -30,7 +29,7 @@ def configure(env):
length = lead + 1 + len(args[begin]) length = lead + 1 + len(args[begin])
for i in range(4, len(args)): for i in range(4, len(args)):
length += 1 + len(args[i]) length += 1 + len(args[i])
if length > 8153: if length > 8158:
cmdline = " ".join(args[0:3] + args[begin:i]) cmdline = " ".join(args[0:3] + args[begin:i])
# print("objs=", i - begin, ", length=", len(cmdline)) # print("objs=", i - begin, ", length=", len(cmdline))
rv = mySubProcess(cmdline, env) rv = mySubProcess(cmdline, env)