In [1]:
import os,sys
sys.path.insert(0, os.path.abspath('..'))

from hublib.ui import RunCommand



In [2]:
def my_start(s):
    #s.run("uname -a; foobar; whoami; xyzzy")
    # s.run("cat file_1M.txt")
    #s.run('cat /usr/share/dict/words')
    #s.run("sdkjgakjga")
    s.run("while true; do echo Hi; sleep 1; done")

In [3]:
# after the run finished, optionally do something
# with the output
def read_data(s):
    # output is in s.output.value
    # Note that this may be truncated for very long output.
    # Commands with lots of output that needs saving should be redirected to 
    # a file or saved by using the 'outcb' callback.
    print('DONE. Buffer contains %d bytes' % len(s.output.value))

In [4]:
rc = RunCommand(start_func=my_start, done_func=read_data)
rc



In [ ]: