summaryrefslogtreecommitdiff
path: root/src/shell_manager.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2021-01-22 17:15:59 +1100
committerMaxime Coste <mawww@kakoune.org>2021-01-22 17:22:15 +1100
commit74fc52b3de6927632b5a8484f68f68bd34f383d5 (patch)
treeecea747cb82b7d99d20a0e9740f360a92031ad4d /src/shell_manager.cc
parent841ec2e5887bb970cbf5c04db27ddbd6685ba011 (diff)
Write to stderr if execve fails
This should be rare but should not happen silently, this way it will show in the parent process debug buffer.
Diffstat (limited to 'src/shell_manager.cc')
-rw-r--r--src/shell_manager.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shell_manager.cc b/src/shell_manager.cc
index 8f6e57ac..93a9f3fe 100644
--- a/src/shell_manager.cc
+++ b/src/shell_manager.cc
@@ -105,7 +105,7 @@ template<typename Func>
pid_t spawn_shell(const char* shell, StringView cmdline,
ConstArrayView<String> params,
ConstArrayView<String> kak_env,
- Func setup_child)
+ Func setup_child) noexcept
{
Vector<const char*> envptrs;
for (char** envp = environ; *envp; ++envp)
@@ -128,6 +128,8 @@ pid_t spawn_shell(const char* shell, StringView cmdline,
setup_child();
execve(shell, (char* const*)execparams.data(), (char* const*)envptrs.data());
+ char buffer[1024];
+ write(STDERR_FILENO, format_to(buffer, "execve failed: {}\n", errno));
_exit(-1);
return -1;
}