Skip to content

Commit 6202fab

Browse files
committed
fix: preserve executable bits in npm bundles
1 parent b327073 commit 6202fab

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

codex-cli/scripts/build_npm_package.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ def copy_native_binaries(
383383
if dest_component_dir.exists():
384384
shutil.rmtree(dest_component_dir)
385385
shutil.copytree(src_component_dir, dest_component_dir)
386+
ensure_executable_files(dest_component_dir)
386387

387388
if target_filter is not None:
388389
missing_targets = sorted(target_filter - copied_targets)
@@ -391,6 +392,15 @@ def copy_native_binaries(
391392
raise RuntimeError(f"Missing target directories in vendor source: {missing_list}")
392393

393394

395+
def ensure_executable_files(root: Path) -> None:
396+
for path in root.rglob("*"):
397+
if not path.is_file():
398+
continue
399+
400+
current_mode = path.stat().st_mode
401+
path.chmod(current_mode | 0o111)
402+
403+
394404
def run_npm_pack(staging_dir: Path, output_path: Path) -> Path:
395405
output_path = output_path.resolve()
396406
output_path.parent.mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)