diff options
| author | Maxime Coste <mawww@kakoune.org> | 2024-12-25 16:38:42 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-12-25 16:38:42 +1100 |
| commit | adbc79bf4084644dff7bf55f52a966f6f26f8fd3 (patch) | |
| tree | b416da3b0d5995907ff0bad2eb8f6d48fc23bb66 /src | |
| parent | 850feb2b3bcbb4917b667541cd6b4b0a4b69f816 (diff) | |
| parent | f8c905d50b9b2cdaf6297c09fde5999e6b7eafe2 (diff) | |
Merge remote-tracking branch 'enricozb/enricozb/daemon-stdin' into HEAD
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main.cc b/src/main.cc index 48368ab6..ac9af4ca 100644 --- a/src/main.cc +++ b/src/main.cc @@ -689,16 +689,6 @@ pid_t fork_server_to_background() std::unique_ptr<UserInterface> create_local_ui(UIType ui_type) { - if (ui_type == UIType::Terminal and not isatty(0)) - { - // move stdin to another fd, and restore tty as stdin - int fd = dup(0); - int tty = open("/dev/tty", O_RDONLY); - dup2(tty, 0); - close(tty); - create_fifo_buffer("*stdin*", fd, Buffer::Flags::None, AutoScroll::NotInitially); - } - auto ui = make_ui(ui_type); static SignalHandler old_handler = set_signal_handler(SIGTSTP, [](int sig) { @@ -885,6 +875,16 @@ int run_server(StringView session, StringView server_init, int exit_status = 0; try { + if (ui_type == UIType::Terminal and not isatty(0)) + { + // move stdin to another fd, and restore tty as stdin + int fd = dup(0); + int tty = open("/dev/tty", O_RDONLY); + dup2(tty, 0); + close(tty); + create_fifo_buffer("*stdin*", fd, Buffer::Flags::None, AutoScroll::NotInitially); + } + if (not server.is_daemon()) { local_client = client_manager.create_client( |
