Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion spin/cmds/meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import re
import shutil
import signal
import sys
from enum import Enum
from pathlib import Path
Expand Down Expand Up @@ -815,7 +816,27 @@ def run(ctx, *, args, build_dir=None):
cmd_args = ["bash", "-c", cmd_args]

_set_pythonpath(build_dir, quiet=True)
p = _run(cmd_args, echo=False, shell=shell, sys_exit=False)

is_windows = sys.platform == "win32"

if not is_windows:
# Let the subprocess handle its own signals
# Except on Windows, where it already seems to work as intended,
# and `preexec_fn` is not supported
signal.signal(signal.SIGINT, signal.SIG_IGN)

def attach_sigint():
# Reset SIGINT handler to default
signal.signal(signal.SIGINT, signal.SIG_DFL)

# --- launch subprocess ---
p = _run(
cmd_args,
echo=False,
shell=shell,
sys_exit=False,
preexec_fn=None if is_windows else attach_sigint,
)

# Is the user trying to run a Python script, without calling the Python interpreter?
executable = args[0]
Expand Down