* server/tab: Don't panic in `Pane::render`
and do not crash the application on failure to receive a render update
from plugins any longer. Instead, will print a simple string with a hint
to check the application logs, where a more thorough error indication
can be found.
* utils/errors: re-export `anyhow::Error`
to create ad-hoc errors with custom error types, without having to wrap
them into a `context()` before to turn the into anyhow errors.
* plugins: Check plugin version on startup
and terminate execution with a descriptive error message in case the
plugin version is incompatible with the version of zellij being run.
* server/wasm_vm: Add plugin path in version error
so the user knows which plugin to look at in case they're using custom
plugins.
* server/wasm_vm: Check plugin version for equality
Previously we would accept cases where the plugin version was newer than
the zellij version, which doesn't make a lot of sense.
* server/wasm_vm: Prettier error handling
in call to `wasmer::Function::call` in case a plugin version mismatch
can occur.
* tile: Install custom panic handler
that will print the panic message to a plugins stdout and then call a
panic handler on the host that turns it into a real application-level
panic.
* tile: Catch errors in event deserialization
and turn them into proper panics. These errors are symptomatic of an
uncaught plugin version mismatch, for example when developing from main
and compiling zellij/the plugins from source. Normal users should never
get to see this error.
* utils/errors: Improve output in `to_stdout`
for anyhow errors. The default anyhow error formatting of `{:?}` is
already very good, and we just made it worse by trying to invent our own
formatting.
* tile: Reword plugin mismatch error message
* zellij: Apply rustfmt
* changelog: Add PR #1838
Improve error handling on plugin version mismatch.
* server/wasm_vm: Rephrase error in passive voice
* server/wasm_vm: Compact module imports
* utils/errors: Impl `to_anyhow` for PoisonError
which is returned by calls to `lock` on various types of locks from
`std`. In our case, some of the locks we try to acquire in `wasm_vm` can
contain an `mpsc::Sender`, which is `!Send` and hence doesn't work with
`anyhow`. Turn the `PoisonError` into an error string instead and
returns that as `anyhow::Err`.
* wasm_vm: Remove calls to `unwrap`
in the WASM VM codes server API. Note that this doesn't include the
Plugin APIs. Mark the error as `fatal` in `server/lib`, where the wasm
thread is created.
This will cause zellij to report a proper error (and log it) when any of
the plugin-related functions fails. Unfortunately, this closes the
channel to the WASM thread. Hence, when loading the plugins upon startup
fails, the error reported in the terminal (visible to the user) hints
towards a call in `plugin_pane` being the culprit. However, the real
error will be contained in the logs.
Also add an error message and print it to the user in case that the
plugin failure was caused by a plugin version mismatch.
* server/wasm_vm: Restore panic on failure to load
plugins.
* server/wasm_vm: Add fix to plugin mismatch error
* server/panes/plugin_pane: Hint to logs
when failing to receive a message from the plugins for rendering pane
contents.
* docs: Describe how to handle Options as errors
* CONTRIBUTING: Add tips for code contributions
which will be home to condensed tips and best-practices around the
zellij code. Currently explains to prefer returning `Result` types
instead of `unwrap`ing on them.
The tips in here are meant to be short, concise guides that allow the
user to get started without a lot of reading. The individual tips can
(and should) be supplemented with links to "further reading" where the
topic at hand is explained in greater detail.
* feat(cli): move command to the end of the cli arguments
* feat(cli): allow naming panes from the command line
* fix(cli): adjust actions after pane rename
* feat(cli): zellij run completions for fish
* feat(cli): zellij run completions for bash and zsh
* style(fmt): rustfmt
* fix(e2e): fix run test and snapshot
* style(fmt): rustfmt
* zellij: Add global `DEBUG_MODE` variable
that tells us whether zellij was started with the `--debug` CLI flag.
* utils/errors: Only log thread_bus message in debug
mode, and discard the message otherwise.
* utils/logging: Increase logsize to 16 MiB
per logfile, totaling 32 MiB of logs at most (in two files).
* zellij: Set global `DEBUG` variable in server
thread and make sure the value of the `--debug` CLI flag is propagated
to the server, too.
This means that to enable debug mode, the server must be started with
the `--debug` flag. This happens when the first client that starts the
zellij session has the `--debug` flag set, because it will be forwarded
to the server. Subsequent clients attaching to the same session with the
`--debug` flag specified **do not** override the value of the `DEBUG`
variable. Hence, if the server wasn't started in debug mode, this cannot
be changed.
* feat(layouts): allow defining a global cwd
* feat(layouts): allow passing global cwd from cli
* style(fmt): rustfmt
* fix(layouts): error on mixed cwd and pane children
* fix(layouts): error on non-bare children node
* refactor(layout): consolidate split direction parsing
* refactor(layout): remove unused import
* fix(layouts): log error when there is no room for layout
* fix(layout): error on size 0
* feat(layouts): allow pane templates to override template command attributes
* style(fmt): rustfmt
* zellij/commands: Prevent recursive sessions
with session names specified in layout files. A "recursive session" is
created when, while running inside some zellij session, a user attempts
to spawn zellij and make it attach to that same session.
When attaching via CLI (`zellij attach`) we explicitly check for this
condition and error out when needed.
However, besides `zellij attach` it is also possible to declare the
session to attach to in layout files like so:
```yaml
session:
name: "foo"
```
This takes a different codepath when starting zellij, and hence bypases
the checks we already have in place to avoid recursive sessions. Hence,
we implement the check in the other codepath, too, and prevent recursive
sessions from happening for good.
Fixes: #1735
* changelog: fix recursive zellij sessions