github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/trypipeerr.md (about)

     1  # `trypipeerr`
     2  
     3  > Checks state of each function in a pipeline and exits block on error
     4  
     5  ## Description
     6  
     7  `trypipeerr` checks the state of each function and exits the block if any of them
     8  fail. Where `trypipeerr` differs from regular `tryerr` blocks is `trypipeerr` will
     9  check every process along the pipeline as well as the terminating function (which
    10  `tryerr` only validates against). The downside to this is that piped functions can
    11  no longer run in parallel.
    12  
    13  ## Usage
    14  
    15  ```
    16  trypipeerr { code-block } -> <stdout>
    17  
    18  <stdin> -> trypipeerr { -> code-block } -> <stdout>
    19  ```
    20  
    21  ## Examples
    22  
    23  ```
    24  trypipeerr {
    25      out "Hello, World!" -> grep: "non-existent string" -> cat
    26      out "This command will be ignored"
    27  }
    28  ```
    29  
    30  Formated pager (`less`) where the pager isn't called if the formatter (`pretty`) fails (eg input isn't valid JSON):
    31  
    32  ```
    33  func pless {
    34      -> trypipeerr { -> pretty -> less }
    35  }
    36  ```
    37  
    38  ## Detail
    39  
    40  A failure is determined by:
    41  
    42  * Any process that returns a non-zero exit number
    43  * Any process that returns more output via STDERR than it does via STDOUT
    44  
    45  You can see which run mode your functions are executing under via the `fid-list`
    46  command.
    47  
    48  ## See Also
    49  
    50  * [Schedulers](../user-guide/schedulers.md):
    51    Overview of the different schedulers (or 'run modes') in Murex
    52  * [`catch`](../commands/catch.md):
    53    Handles the exception code raised by `try` or `trypipe`
    54  * [`fid-list`](../commands/fid-list.md):
    55    Lists all running functions within the current Murex session
    56  * [`if`](../commands/if.md):
    57    Conditional statement to execute different blocks of code depending on the result of the condition
    58  * [`runmode`](../commands/runmode.md):
    59    Alter the scheduler's behaviour at higher scoping level
    60  * [`switch`](../commands/switch.md):
    61    Blocks of cascading conditionals
    62  * [`try`](../commands/try.md):
    63    Handles non-zero exits inside a block of code
    64  * [`tryerr`](../commands/tryerr.md):
    65    Handles errors inside a block of code
    66  * [`trypipe`](../commands/trypipe.md):
    67    Checks for non-zero exits of each function in a pipeline
    68  * [`unsafe`](../commands/unsafe.md):
    69    Execute a block of code, always returning a zero exit number
    70  
    71  <hr/>
    72  
    73  This document was generated from [builtins/core/structs/tryerr_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/structs/tryerr_doc.yaml).