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

     1  # `unsafe`
     2  
     3  > Execute a block of code, always returning a zero exit number
     4  
     5  ## Description
     6  
     7  `unsafe` is similar to normal execution except that the exit number for the
     8  last function in the `unsafe` block is ignored. `unsafe` always returns `0`.
     9  
    10  This is useful in any situations where you might want errors ignored.
    11  
    12  ## Usage
    13  
    14  ```
    15  unsafe { code-block } -> <stdout>
    16  
    17  <stdin> -> unsafe { -> code-block } -> <stdout>
    18  ```
    19  
    20  ## Examples
    21  
    22  ```
    23  try {
    24      unsafe { err "foobar" }
    25      out "This message still displays because the error is inside an `unsafe` block"
    26  }
    27  ```
    28  
    29  ## See Also
    30  
    31  * [Schedulers](../user-guide/schedulers.md):
    32    Overview of the different schedulers (or 'run modes') in Murex
    33  * [`catch`](../commands/catch.md):
    34    Handles the exception code raised by `try` or `trypipe`
    35  * [`fid-list`](../commands/fid-list.md):
    36    Lists all running functions within the current Murex session
    37  * [`if`](../commands/if.md):
    38    Conditional statement to execute different blocks of code depending on the result of the condition
    39  * [`runmode`](../commands/runmode.md):
    40    Alter the scheduler's behaviour at higher scoping level
    41  * [`switch`](../commands/switch.md):
    42    Blocks of cascading conditionals
    43  * [`try`](../commands/try.md):
    44    Handles non-zero exits inside a block of code
    45  * [`tryerr`](../commands/tryerr.md):
    46    Handles errors inside a block of code
    47  * [`trypipe`](../commands/trypipe.md):
    48    Checks for non-zero exits of each function in a pipeline
    49  * [`trypipeerr`](../commands/trypipeerr.md):
    50    Checks state of each function in a pipeline and exits block on error
    51  
    52  <hr/>
    53  
    54  This document was generated from [builtins/core/structs/try_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/structs/try_doc.yaml).