Skip to content

Commit

Permalink
remote and os changes
Browse files Browse the repository at this point in the history
  • Loading branch information
latentvector committed Aug 6, 2024
1 parent 57dc485 commit bd00c07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion commune/module/_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def stream_output(process):
modes = ['stdout', 'stderr']
for mode in modes:
pipe = getattr(process, mode)
if pipe == None:
continue
for line in iter(pipe.readline, b''):
line = line.decode('utf-8')
if verbose:
Expand All @@ -261,7 +263,7 @@ def stream_output(process):
else:
text = ''
for ch in streamer:
text += ch
text += (ch + '\n')
return text


Expand Down
3 changes: 2 additions & 1 deletion commune/modules/remote/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,15 @@ def ssh(self):
emoji = c.emoji("cross") if is_error else c.emoji("check")
stats = host2stats.get(host, {'success': 0, 'error': 0})
title = f'{emoji} :: {host} :: {emoji}'

if not is_error:
msg = result.strip()
msg = fn_code(msg)
stats['last_success'] = c.time()
stats['success'] += 1
with st.expander(f'Results {host}', expanded=expanded):
st.write(title)
st.write(msg)
st.code('\n'.join(msg.split('\n')))
else:
msg = result
stats['error'] += 1
Expand Down

0 comments on commit bd00c07

Please sign in to comment.