Fixing some logic issues in sys_command

This commit is contained in:
Anton Hvornum 2019-06-20 19:01:34 +00:00
parent 6a0e906ac7
commit d338b5f51e
1 changed files with 16 additions and 0 deletions

View File

@ -220,6 +220,22 @@ class sys_command():
# Since we're in a subsystem, we gotta bail out!
# Bail bail bail!
os.write(child_fd, b'shutdown now\n')
print('[N] Shutdown initated')
last = time()
while time()-last < 5:
for fileno, event in poller.poll(0.1):
try:
output = os.read(child_fd, 8192).strip()
trace_log += output
except OSError:
last = time() - 60
break
if 'debug' in self.opts and self.opts['debug']:
if len(output):
print(output)
last = time()
if 'debug' in self.opts and self.opts['debug']:
print('[N] Waiting for exit code.')