Skip to content
Merged
Show file tree
Hide file tree
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: 2 additions & 2 deletions reframe/utility/os_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def run_command(cmd, check=False, timeout=None, shell=False):
except subprocess.TimeoutExpired as e:
os.killpg(proc.pid, signal.SIGKILL)
raise SpawnedProcessTimeout(e.cmd,
proc.stdout,
proc.stderr, timeout) from None
proc.stdout.read(),
proc.stderr.read(), timeout) from None

completed = subprocess.CompletedProcess(args=shlex.split(cmd),
returncode=proc.returncode,
Expand Down
5 changes: 4 additions & 1 deletion unittests/test_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ def test_command_error(self):
def test_command_timeout(self):
try:
os_ext.run_command('sleep 3', timeout=2)
self.fail('Expected timeout')
except SpawnedProcessTimeout as e:
self.assertEqual(e.timeout, 2)
# Try to get the string repr. of the exception: see bug #658
s = str(e)
else:
self.fail('expected timeout')

def test_command_async(self):
from datetime import datetime
Expand Down