From 48f34ea9663480d0e5d6d216ef8f94ed006d3f42 Mon Sep 17 00:00:00 2001 From: Deb Sourav Date: Thu, 12 Jan 2023 01:26:49 -0700 Subject: [PATCH] added timeout attribute --- src/comby/binary.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/comby/binary.py b/src/comby/binary.py index 6147058..43aab20 100644 --- a/src/comby/binary.py +++ b/src/comby/binary.py @@ -37,6 +37,7 @@ class CombyBinary(CombyInterface): """ location = attr.ib(type=str, default='comby') language = attr.ib(type=str, default='.c') + timeout: Optional[int] = 60 @property def version(self) -> str: @@ -68,6 +69,9 @@ def call(self, args: str, text: Optional[str] = None) -> str: input_ = text.encode('utf8') logger.debug(f'supplying input text: {text}') + if self.timeout is not None: + args += f' -timeout {self.timeout}' + cmd_s = f'{self.location} {args}' p = subprocess.run(cmd_s, shell=True,