1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-27 11:52:43 +00:00

docs(custom): add warning about custom command potentially freezing terminal (#1242)

This commit is contained in:
Jimmy Royer 2020-05-28 11:37:54 -04:00 committed by GitHub
parent 9dcd50305a
commit a3470bf9fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1447,6 +1447,29 @@ This behavior can be avoided by explicitly passing arguments to the shell, e.g.
shell = ["pwsh", "-Command", "-"] shell = ["pwsh", "-Command", "-"]
``` ```
::: warning Make sure your custom shell configuration exits gracefully
If you set a custom command, make sure that the default Shell used by starship
will properly execute the command with a graceful exit (via the `shell`
option).
For example, PowerShell requires the `-Command` parameter to execute a one
liner. Omitting this parameter might throw starship into a recursive loop
where the shell might try to load a full profile environment with starship
itself again and hence re-execute the custom command, getting into a never
ending loop.
Parameters similar to `-NoProfile` in PowerShell are recommended for other
shells as well to avoid extra loading time of a custom profile on every
starship invocation.
Automatic detection of shells and proper parameters addition are currently
implemented, but it's possible that not all shells are covered.
[Please open an issue](https://github.com/starship/starship/issues/new/choose)
with shell details and starship configuration if you hit such scenario.
:::
### Example ### Example
```toml ```toml
@ -1457,6 +1480,12 @@ command = "echo foo" # shows output of command
files = ["foo"] # can specify filters files = ["foo"] # can specify filters
when = """ test "$HOME" == "$PWD" """ when = """ test "$HOME" == "$PWD" """
prefix = " transcending " prefix = " transcending "
[custom.time]
command = "time /T"
files = ["*.pst"]
prefix = "transcending "
shell = ["pwsh.exe", "-NoProfile", "-Command", "-"]
``` ```
## PureScript ## PureScript