Skip to content

fix: Do not set signal when not in main thread #2358

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 22, 2025
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
4 changes: 3 additions & 1 deletion ocp_resources/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import re
import sys
import threading
from collections.abc import Callable, Generator
from io import StringIO
from signal import SIGINT, signal
Expand Down Expand Up @@ -582,7 +583,8 @@ def to_dict(self) -> None:
self._base_body()

def __enter__(self) -> Any:
signal(SIGINT, self._sigint_handler)
if threading.current_thread().native_id == threading.main_thread().native_id:
signal(SIGINT, self._sigint_handler)
return self.deploy(wait=self.wait_for_resource)

def __exit__(
Expand Down