[jsinterp] Implement timeout

Workaround for #4716
This commit is contained in:
pukkandan 2022-08-22 06:19:06 +05:30
parent 822d66e591
commit 992dc6b486
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
3 changed files with 10 additions and 6 deletions

View file

@ -860,9 +860,9 @@ class Popen(subprocess.Popen):
self.wait(timeout=timeout)
@classmethod
def run(cls, *args, **kwargs):
def run(cls, *args, timeout=None, **kwargs):
with cls(*args, **kwargs) as proc:
stdout, stderr = proc.communicate_or_kill()
stdout, stderr = proc.communicate_or_kill(timeout=timeout)
return stdout or '', stderr or '', proc.returncode