[konsole] [Bug 462495] Konsole need to implement openpty mode to support gdb's --tty option

bugzilla_noreply at kde.org bugzilla_noreply at kde.org
Sat Dec 3 00:17:34 GMT 2022


https://bugs.kde.org/show_bug.cgi?id=462495

--- Comment #4 from ninjalj at gmail.com ---
On Linux something like the following would output the tty device name. The
sleep may need to be tweaked.

die()
{
    echo "$@" >&2
    exit 1
}

konsole --noclose -e /usr/bin/tty &
konsolepid=$!

sleep 1

for fd in /proc/$konsolepid/fd/* 
do
    [ "x$(readlink $fd)" = x"/dev/ptmx" ] && ptmx=$fd && break
done

[ -z $ptmx ] && die "konsole process doesn't appear to have opened a pty
master"

ptmx=${ptmx/fd/fdinfo}
awk -F: '/tty-index/{ print "/dev/pts/"$2+0 }' $ptmx

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the konsole-devel mailing list