BLOCK(1) fish-shell BLOCK(1)

# [NAME](#NAME)

block - temporarily block delivery of events

# [SYNOPSIS](#SYNOPSIS)

```
block [(--local | --global)]
block --erase
```

# [DESCRIPTION](#DESCRIPTION)

**block** delays delivery of all events triggered by **fish** or the emit &lt;&gt;, thus delaying the execution of any function registered **--on-event**, **--on-process-exit**, **--on-job-exit**, **--on-variable** and **--on-signal** until after the block is removed.

Event blocks should not be confused with code blocks, which are created with **begin**, **if**, **while** or **for**

Without options, **block** sets up a block that is released automatically at the end of the current function scope.

The following options are available:

[**-l** or **--local**](#l)

Release the block automatically at the end of the current innermost code block scope.

[**-g** or **--global**](#g)

Never automatically release the lock.

[**-e** or **--erase**](#e)

Release global block.

[**-h** or **--help**](#h)

Display help about using this command.

# [EXAMPLE](#EXAMPLE)

```
# Create a function that listens for events
function --on-event foo foo; echo 'foo fired'; end
# Block the delivery of events
block -g
emit foo
# No output will be produced
block -e
# 'foo fired' will now be printed
```

# [NOTES](#NOTES)

Events are only received from the current fish process as there is no way to send events from one fish process to another.

# [Copyright](#Copyright)

fish-shell developers

October 15, 2026 4.9

---

Document: block(1) from fish 4.9.3-r3 (Chainguard OS)
Source: https://github.com/fish-shell/fish-shell
