Skip to content

Need way for await sh.command to return RunningCommand #743

@hartmans

Description

@hartmans

I'm finally porting Carthage from sh 1.x to sh 2.x. We had our own hack to enable async for sh, and we had a lot of code that did things like

result = await sh.ssh(...)

And then for example looked at result.stdout.
So, part of this can be handled by setting _return_cmd=True, but the definition of RunningCommand.__await__ is hard-coded to return str(self).
Obviously, I can do something like

result = sh.ssh(...)
await result

But that feels clumsy.
I'd like a kwarg that returns a RunningCommand even on async await.
My preference would be to try and convince you that _return_cmd should affect await as well as call, but if you are concerned about the API instability, I'm happy with anything that I can pass into bake.

Thanks for your consideration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions