Skip to content

Commit 66c7623

Browse files
authored
Use exec_process in emcmake/emmake/emconfigure. NFC (#25452)
As well as speeding things up I hope this side steps #25450.
1 parent 7125c45 commit 66c7623

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

emcmake.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from tools import shared
1212
from tools import config
1313
from tools import utils
14-
from subprocess import CalledProcessError
1514

1615

1716
#
@@ -63,11 +62,7 @@ def has_substr(args, substr):
6362
return 1
6463

6564
print(f'emcmake: {shlex.join(args)} in directory {os.getcwd()}', file=sys.stderr)
66-
try:
67-
shared.check_call(args)
68-
return 0
69-
except CalledProcessError as e:
70-
return e.returncode
65+
shared.exec_process(args)
7166

7267

7368
if __name__ == '__main__':

emconfigure.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import sys
2222
from tools import building
2323
from tools import shared
24-
from subprocess import CalledProcessError
2524

2625

2726
#
@@ -50,11 +49,8 @@ def run():
5049
# is a heuristic emulation that may or may not work.
5150
env['EMMAKEN_JUST_CONFIGURE'] = '1'
5251
print(f'emconfigure: {shlex.join(args)} in directory {os.getcwd()}', file=sys.stderr)
53-
try:
54-
shared.check_call(args, env=env)
55-
return 0
56-
except CalledProcessError as e:
57-
return e.returncode
52+
os.environ.update(env)
53+
shared.exec_process(args)
5854

5955

6056
if __name__ == '__main__':

emmake.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from tools import building
2929
from tools import shared
3030
from tools import utils
31-
from subprocess import CalledProcessError
3231

3332

3433
#
@@ -59,11 +58,11 @@ def run():
5958
# executable extension lookup, e.g. 'sdl2-config' will match with
6059
# 'sdl2-config.bat' in PATH.
6160
print(f'emmake: "{shlex.join(args)}" in "{os.getcwd()}"', file=sys.stderr)
62-
try:
63-
shared.check_call(args, shell=utils.WINDOWS, env=env)
64-
return 0
65-
except CalledProcessError as e:
66-
return e.returncode
61+
if utils.WINDOWS:
62+
return shared.run_process(args, check=False, shell=True, env=env).returncode
63+
else:
64+
os.environ.update(env)
65+
shared.exec_process(args)
6766

6867

6968
if __name__ == '__main__':

0 commit comments

Comments
 (0)