Skip to content

Commit a9e18d8

Browse files
authored
Boostrap.py: Check for npm in path before trying to use it (#23795)
1 parent e15cc69 commit a9e18d8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bootstrap.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
('npm packages', [
2424
'package.json',
2525
'package-lock.json'
26-
], [shutil.which('npm'), 'ci']),
26+
], ['npm', 'ci']),
2727
('create entry points', [
2828
'tools/maint/create_entry_points.py',
2929
'tools/maint/run_python.bat',
@@ -34,7 +34,7 @@
3434
'test/third_party/posixtestsuite/',
3535
'test/third_party/googletest',
3636
'test/third_party/wasi-test-suite',
37-
], [shutil.which('git'), 'submodule', 'update', '--init']),
37+
], ['git', 'submodule', 'update', '--init']),
3838
]
3939

4040

@@ -87,6 +87,11 @@ def main(args):
8787
if args.dry_run:
8888
print(' (skipping: dry run) -> %s' % ' '.join(cmd))
8989
continue
90+
orig_exe = cmd[0]
91+
if not os.path.isabs(orig_exe):
92+
cmd[0] = shutil.which(orig_exe)
93+
if not cmd[0]:
94+
utils.exit_with_error(f'command not found: {orig_exe}')
9095
print(' -> %s' % ' '.join(cmd))
9196
shared.run_process(cmd, cwd=utils.path_from_root())
9297
utils.safe_ensure_dirs(STAMP_DIR)

0 commit comments

Comments
 (0)