Skip to content

Commit 869f2c2

Browse files
committed
Fixed at detection leaving stragglers when warnings are printed by at
before the job number
1 parent 10aa3ff commit 869f2c2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/installer/install_methods.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import re
23
import subprocess
34
import time
45
from abc import ABC, abstractmethod
@@ -135,11 +136,13 @@ def is_available(self) -> Tuple[bool, Optional[str]]:
135136
if ec != 0:
136137
return False, 'not found'
137138
time.sleep(0.2)
138-
if out.startswith('job'):
139-
job_no = out.split()[1]
140-
_run(f'atrm {job_no}')
141-
if 'No atd' in out:
142-
return False, 'not running'
139+
match = re.search('job ([0-9]+)', out)
140+
if not match:
141+
return False, 'error'
142+
job_no = match.group(1)
143+
_run(f'atrm {job_no}')
144+
if 'No atd' in out:
145+
return False, 'not running'
143146
if os.path.exists(path):
144147
os.remove(path)
145148
return False, 'unknown error'

0 commit comments

Comments
 (0)