https://prefect.io logo
Title
d

DiffyBron

12/09/2019, 5:18 AM
hello, i'm trying to run a shell and it seems that it only outputs one line when i perform 'ls -lat' is that an expected behavior? (I've taken bits and pieces from here : https://github.com/PrefectHQ/prefect/issues/1013
from prefect import Flow, task
from prefect.tasks.shell import ShellTask

my_task = ShellTask(helper_script="cd /etc")

@task
def print_output(output):
  print(output)

with Flow("My shell") as flow:
  result = my_task(command='ls -lat')
  print_output(result)

if __name__ == '__main__':
    out = flow.run()
c

Chris White

12/09/2019, 5:20 AM
Yup that is expected; shell tasks only return the last line by default but that can be configured as described here: https://docs.prefect.io/api/unreleased/tasks/shell.html#shelltask
👍 1
d

DiffyBron

12/09/2019, 5:50 AM
perfect !