forked from bellwether/minerva
okay guess it's suddenly working
This commit is contained in:
parent
1b63d30539
commit
92c769a2b0
1 changed files with 7 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ class Command:
|
||||||
self.machine = machine
|
self.machine = machine
|
||||||
self.command = command
|
self.command = command
|
||||||
self.disown = disown
|
self.disown = disown
|
||||||
self.watch = watch
|
self.watch = True#watch
|
||||||
self.logset = logset
|
self.logset = logset
|
||||||
self.thread = None
|
self.thread = None
|
||||||
|
|
||||||
|
|
@ -36,6 +36,8 @@ class Command:
|
||||||
# https://github.com/paramiko/paramiko/issues/593#issuecomment-145377328
|
# https://github.com/paramiko/paramiko/issues/593#issuecomment-145377328
|
||||||
#
|
#
|
||||||
def execute(self):
|
def execute(self):
|
||||||
|
print(f"running: {self.command}")
|
||||||
|
print("\t", self.logset)
|
||||||
stdin, stdout, stderr = self.machine.ssh.client.exec_command(self.command)
|
stdin, stdout, stderr = self.machine.ssh.client.exec_command(self.command)
|
||||||
|
|
||||||
# this is the same for all three inputs
|
# this is the same for all three inputs
|
||||||
|
|
@ -86,16 +88,20 @@ class Command:
|
||||||
break
|
break
|
||||||
for c in readq:
|
for c in readq:
|
||||||
if c.recv_ready():
|
if c.recv_ready():
|
||||||
|
print(f"\t{len(c.in_buffer)} in stdout")
|
||||||
flush_data(channel.recv(len(c.in_buffer)),
|
flush_data(channel.recv(len(c.in_buffer)),
|
||||||
out,
|
out,
|
||||||
(self.watch and sys.stdout.buffer))
|
(self.watch and sys.stdout.buffer))
|
||||||
got_chunk = True
|
got_chunk = True
|
||||||
|
print(f"\t{len(c.in_buffer)} left in stdout")
|
||||||
|
|
||||||
if c.recv_stderr_ready():
|
if c.recv_stderr_ready():
|
||||||
|
print(f"\t{len(c.in_stderr_buffer)} in stderr")
|
||||||
flush_data(channel.recv_stderr(len(c.in_stderr_buffer)),
|
flush_data(channel.recv_stderr(len(c.in_stderr_buffer)),
|
||||||
err,
|
err,
|
||||||
(self.watch and sys.stderr.buffer))
|
(self.watch and sys.stderr.buffer))
|
||||||
got_chunk = True
|
got_chunk = True
|
||||||
|
print(f"\t{len(c.in_stderr_buffer)} left in stderr")
|
||||||
# for c
|
# for c
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
@ -132,8 +138,6 @@ class Command:
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
|
||||||
if not self.disown:
|
if not self.disown:
|
||||||
print(f"running: {self.command}")
|
|
||||||
print(self.logset)
|
|
||||||
self.thread.join()
|
self.thread.join()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue