A promise of some future `Result`, yielded from asynchronous execution. This class' primary API member is `join`; instances may also be used as context managers, which will automatically call `join` when the block exits. In such cases, the context manager yields ``self``. `Promise` also exposes copies of many `Result` attributes, specifically those that derive from `~Runner.run` kwargs and not the result of command execution. For example, ``command`` is replicated here, but ``stdout`` is not. .. versionadded:: 1.4
Method | __enter__ |
Undocumented |
Method | __exit__ |
Undocumented |
Method | __init__ |
Create a new promise. |
Method | join |
Block until associated subprocess exits, returning/raising the result. |
Instance Variable | runner |
Undocumented |
Inherited from Result
:
Method | __bool__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | tail |
Return the last ``count`` lines of ``stream``, plus leading whitespace. |
Instance Variable | command |
Undocumented |
Instance Variable | encoding |
Undocumented |
Instance Variable | env |
Undocumented |
Instance Variable | exited |
Undocumented |
Instance Variable | hide |
Undocumented |
Instance Variable | pty |
Undocumented |
Instance Variable | shell |
Undocumented |
Instance Variable | stderr |
Undocumented |
Instance Variable | stdout |
Undocumented |
Property | failed |
The inverse of ``ok``. |
Property | ok |
A boolean equivalent to ``exited == 0``. |
Property | return |
An alias for ``.exited``. |
invoke.runners.Result.__init__
Create a new promise. :param runner: An in-flight `Runner` instance making this promise. Must already have started the subprocess and spun up IO threads.
Block until associated subprocess exits, returning/raising the result. This acts identically to the end of a synchronously executed ``run``, namely that: - various background threads (such as IO workers) are themselves joined; - if the subprocess exited normally, a `Result` is returned; - in any other case (unforeseen exceptions, IO sub-thread `.ThreadException`, `.Failure`, `.WatcherError`) the relevant exception is raised here. See `~Runner.run` docs, or those of the relevant classes, for further details.