#Capturing cli output

1 messages · Page 1 of 1 (latest)

chilly horizon
#

I have some runs that if they fail produce a ton of output. I have been struggling with the dagger cli to redirect or capture output. I have tried plaintext and using script. That works okay but is there idiomatic way to capture the output of a run? This is running commands in a standard unix terminal. I did run some google searches and searched on discord but didn't find what I was looking for.

stuck fog
chilly horizon
#

So I think I may have found it. For SDK it would be similar to:

 # Use the saved exit code to determine if the tests passed.
    exit_code = await ctr.file("exit_code").contents()

    if exit_code != "0":
        print("Tests failed!", file=sys.stderr)
    else:
        print("Tests passed!")

for modules it would be something like this: https://github.com/dagger/dagger/issues/5820#issuecomment-1775382506

GitHub

What are you trying to do? I want to drop into a shell inside a dagger container, so I can debug a pipeline and even have a dagger-defined development environment (so that developers would only nee...

stuck fog
#

for modules it's very similar actually. The only difference with modules is that you have the dagger call entrypoing which might not make it easy to fetch the stderr all the time

#

glad you solved this @chilly horizon ! Don't hesitate to ping if you have more questions 🙌