Log error to debug buffer and Change the 'waiting for shell' face
to 'Error'.
Update the 'waiting for shell' message when the shell has exited
but Kakoune is still waiting on stdin/stdout/stderr to be closed.
Those fifos are accessible during %sh{...} blocks, the command fifo
executes commands written to it once the write end side is closed
(multiple open/write/close sequences are supported), the response
fifo is a simple helper fifo available to write response back to
the shell process
An example use of this feature is to request some list options
content from without being limited by the environment size:
```
%sh{
echo "echo -to-file $kak_response_fifo -quoting shell -- %opt{some_list}" > $kak_command_fifo
eval "set -- $(cat $kak_response_fifo)"
}
```
If a %sh{} script refers to any variables multiple times they are all multiply
included in the environment. Example: if a %sh{} invocation refers to
${kak_buffile} 5 times, the environment will have "kak_buffile=..." repeated 5
times and so on. This repetition happens for each multiply used variable that
is passed into the environment.
The variable should, of course, be only passed into the environment once. This
commit should fix this issue.
This avoids 100% CPU usage when we have pending fifo input while running
a shell process, as we will not end-up busy looping in pselect but not
reading the available data due to being only processing urgent events.
Add that libexec directory to the PATH instead of the current kak
binary directory to avoid impacting other commands.
The libexec directory currently only contains a symlink back to
the Kakoune binary.
SIG_IGN is inherited after 'execve' and requires us to reset
that signal handler, which does not work well with vfork on
OSX. Using an empty function does the trick and will be auto
reset to default on exec.
When large buffers have been opened, copying Kakoune's memory
page descriptors can get pretty slow, making fork more expensive
than necessary.
vfork avoids that problem. While not strictly conforming, it seems
the few calls we do before execve (open, close, dup2 and
set_signal_handler) would not cause any problems on platforms we
care about.
set-face now takes a scope argument, and faces can be overridden on
a buffer or window basis.
colorscheme apply on global scope, which should be good enough for
now.
Fixes#1411
We were letting stdin untouched, which meant child processes had
access to our terminal input. That meant `!fmt` was trying to read
from our terminal input and catching keystrokes.
Fixes#1281
Without a timer we were relying on other event sources to wake us
up to display the information, which was usually a NormalIdle or
a filesystem check timer.
If a shell commands takes more than 1s to execute, a message will appear
on the status line notifying the user, along with the time Kakoune has
been waiting for.