Skip to content

Commit

Permalink
fix: replace process on UNIX
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Nov 7, 2024
1 parent 180e693 commit 8bae8c7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cmake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,19 @@ def __dir__() -> list[str]:
def _program(name: str, args: Iterable[str]) -> int:
return subprocess.call([os.path.join(CMAKE_BIN_DIR, name), *args], close_fds=False)

def _program_exit(name: str, *args: str) -> NoReturn:
if sys.platform.startwith("win"):
raise SystemExit(_program(name, args))
os.execl(os.path.join(CMAKE_BIN_DIR, name), name, *args)


def cmake() -> NoReturn:
raise SystemExit(_program('cmake', sys.argv[1:]))
_program_exit('cmake', *sys.argv[1:]))


def cpack() -> NoReturn:
raise SystemExit(_program('cpack', sys.argv[1:]))
_program_exit('cpack', *sys.argv[1:])


def ctest() -> NoReturn:
raise SystemExit(_program('ctest', sys.argv[1:]))
_program_exit('ctest', *sys.argv[1:])

0 comments on commit 8bae8c7

Please sign in to comment.