Skip to content

Commit dc01f6e

Browse files
committed
Updated docs regarding the functionality of redirecting stdout/stderr
1 parent bca3011 commit dc01f6e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ To call the function using Arca, the following example would do so:
101101
102102
The code would print ``Hello World!``.
103103
``result`` would be a ``arca.Result`` instance. ``arca.Result`` has three attributes,
104-
``output`` with the return value of the function call, ``stdout`` and ``stderr`` contain things printed to the standard outputs.
104+
``output`` with the return value of the function call, ``stdout`` and ``stderr`` contain things printed to the standard outputs
105+
(see the section about `Result <http://arca.readthedocs.io/en/latest/tasks.html#result>`_ for more info about the capture of the standard outputs).
105106
If the task fails, ``arca.exceptions.BuildError`` would be raised.
106107

107108
By default, the `Current Environment Backend <https://arca.readthedocs.io/en/latest/backends.html#current-environment>`_ is used to run tasks,

docs/quickstart.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ To call the function using Arca, the following example would do so:
4242
The code would print ``Hello World!``.
4343

4444
``result`` would be a :class:`Result <arca.Result>` instance. :class:`Result <arca.Result>` has three attributes,
45-
``output`` with the return value of the function call, ``stdout`` and ``stderr`` contain things printed to the standard outputs.
45+
``output`` with the return value of the function call, ``stdout`` and ``stderr`` contain things printed to the standard outputs
46+
(see the section about :ref:`Result <result>` for more info about the capture of the standard outputs).
4647
If the task fails, :class:`arca.exceptions.BuildError` would be raised.
4748

4849
By default, the :ref:`Current Environment Backend <backends_cur>` is used to run tasks,

docs/tasks.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ The default value is 5 seconds.
6969

7070
When a task exceeds a timeout, :class:`arca.exceptions.BuildTimeoutError` is raised.
7171

72+
.. _result:
73+
7274
Result
7375
------
7476

@@ -77,3 +79,7 @@ Anything that's json-serializable can be returned from the entrypoints.
7779
The :class:`arca.Result` instances contain three attributes.
7880
``output`` contains the value returned from the entrypoint.
7981
``stdout`` and ``stderr`` contain things written to the standard outputs.
82+
83+
Arca uses :func:`contextlib.redirect_stdout` and :func:`contextlib.redirect_stderrr` to catch the standard outputs,
84+
which only redirect things written from standard Python code -- for example output from a subprocess is not caught.
85+
Due to the way backends launch tasks the callables cannot output anything that is not redirectable by these two context managers.

0 commit comments

Comments
 (0)