summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorSidharth Kshatriya <sid.kshatriya@gmail.com>2021-11-15 02:44:18 +0530
committerSidharth Kshatriya <sid.kshatriya@gmail.com>2021-11-15 11:11:28 +0530
commitdd923910369e52da6fd8722fd0f878efa10f0e4f (patch)
treeb36ac9d129cd5abde99e187eaa3c3c2e3ec6905b /src/main.cc
parente7100dc87434d933fd8268e5bf70080b627750c5 (diff)
Fixes #4432: JSON UI only shows stdin when connecting to an existing session
Only ui type Terminal is intended to be a user interactive session. If your ui type is not Terminal, don't worry about making the tty your stdin if fd 0 is not a tty. This allows json-rpc commands sent via stdin to be acted up rather than sent to a fifo (which is the default behavior for kakoune). Does not change the behavior for Terminal ui sessions
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.cc b/src/main.cc
index 6da6e648..e078efc5 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -692,7 +692,11 @@ int run_client(StringView session, StringView name, StringView client_init,
try
{
Optional<int> stdin_fd;
- if (not isatty(0))
+ // json-ui (or dummy) is not intended to be user interactive.
+ // So only worry about making the tty your stdin if:
+ // (a) ui_type is Terminal, *and*
+ // (b) fd 0 is not interactive.
+ if (ui_type == UIType::Terminal && not isatty(0))
{
// move stdin to another fd, and restore tty as stdin
stdin_fd = dup(0);