Skip to content

Commit 2ed43ea

Browse files
committed
Update 1 code files
Modified: • src/omnipkg/dispatcher.py (+15/-9 lines) [gitship-generated]
1 parent 2418a00 commit 2ed43ea

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

src/omnipkg/dispatcher.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,11 @@ def _install_binary_into_bin_dir(binary_tmp, target_bin, src_hash: str, debug: b
644644
if sys.platform == "win32":
645645
try:
646646
running_exe_resolved = Path(sys.argv[0]).resolve()
647-
# sys.argv[0] on Windows is often bare 'C:\...\8pkg' without .exe
648-
if running_exe_resolved.suffix.lower() != '.exe':
649-
running_exe_resolved = running_exe_resolved.with_suffix('.exe')
647+
# sys.argv[0] on Windows omits .exe — normalize so path comparison works
648+
if sys.platform == 'win32' and running_exe_resolved.suffix.lower() != '.exe':
649+
_with_exe = running_exe_resolved.with_suffix('.exe')
650+
if _with_exe.exists():
651+
running_exe_resolved = _with_exe
650652
except Exception:
651653
pass
652654

@@ -671,7 +673,7 @@ def _install_binary_into_bin_dir(binary_tmp, target_bin, src_hash: str, debug: b
671673
if debug:
672674
print(f"[C-INSTALL] install: {target.name} is the running exe — scheduling ghost swap", file=sys.stderr)
673675
ghost_needed.append((Path(binary_tmp), target))
674-
# DO NOT write marker here — ghost writes it after swap completes.
676+
# DO NOT add to replaced — ghost writes marker after swap.
675677
continue
676678

677679
# ── Normal path: direct copy (Unix always; Windows for non-running exes) ─
@@ -836,7 +838,7 @@ def _install_binary_into_bin_dir(binary_tmp, target_bin, src_hash: str, debug: b
836838
}
837839
}
838840
839-
/* Step 5b: write marker so next invocation skips recompile */
841+
/* Step 5b: write marker after swap so Python side sees hash-match next run */
840842
if (all_ok && marker_path[0] && marker_content[0]) {
841843
FILE *mf = fopen(marker_path, "w");
842844
if (mf) { fputs(marker_content, mf); fclose(mf); }
@@ -955,7 +957,7 @@ def _ghost_spawn_windows(swaps: list, src_hash: str, debug: bool, marker_path=No
955957
if debug:
956958
print(f"[C-INSTALL] ghost: could not derive MSVC env: {e}", file=sys.stderr)
957959

958-
cmd = [cl, str(ghost_c), f"/Fe:{ghost_exe}", "/nologo", "/link", "kernel32.lib"]
960+
cmd = [cl, "/nologo", f"/Fe:{ghost_exe}", str(ghost_c), "/link", "kernel32.lib"]
959961
else:
960962
gcc = shutil.which("gcc") or shutil.which("x86_64-w64-mingw32-gcc")
961963
compile_env = os.environ.copy()
@@ -970,11 +972,15 @@ def _ghost_spawn_windows(swaps: list, src_hash: str, debug: bool, marker_path=No
970972
print(f"[C-INSTALL] ghost: compiling {ghost_c} -> {ghost_exe}", file=sys.stderr)
971973
try:
972974
r = subprocess.run(cmd, capture_output=True, timeout=15, env=compile_env)
975+
if debug:
976+
print(f"[C-INSTALL] ghost: compile rc={r.returncode}", file=sys.stderr)
977+
if r.stdout:
978+
print(f"[C-INSTALL] ghost stdout: {r.stdout.decode(errors='replace')}", file=sys.stderr)
979+
if r.stderr:
980+
print(f"[C-INSTALL] ghost stderr: {r.stderr.decode(errors='replace')}", file=sys.stderr)
973981
if r.returncode != 0:
974982
if debug:
975-
print(f"[C-INSTALL] ghost: compile failed rc={r.returncode}", file=sys.stderr)
976-
if r.stderr:
977-
print(f"[C-INSTALL] ghost: {r.stderr.decode(errors='replace')}", file=sys.stderr)
983+
print(f"[C-INSTALL] ghost: compile failed rc={r.returncode} src={ghost_c} exists={ghost_c.exists()}", file=sys.stderr)
978984
return
979985
except Exception as e:
980986
if debug:

0 commit comments

Comments
 (0)