A pty is a pseudo-terminal - it's a software implementation that appears to the attached program like a terminal, but instead of communicating directly with a "real" terminal, it transfers the input and output to another program.
Questions tagged [pty]
420 questions
395
votes
9 answers
Confused about Docker -t option to Allocate a pseudo-TTY
What exactly does this option do? I've been reading a lot on TTY and I'm still confused. I played around without having the -t and just -i and it seems like programs that expect user input throw an error without the -t. Why is it important for…

user1099123
- 6,063
- 5
- 30
- 35
122
votes
23 answers
How to fix request failed on channel 0
When I want to connect to my server like this
ssh -a username@my-server.de -p 22
it gives me two error messages:
PTY allocation request failed on channel 0
shell request failed on channel 0
When I use the parameter -T the first error message goes…

user1895268
- 1,559
- 3
- 11
- 23
37
votes
4 answers
Can you fool isatty AND log stdout and stderr separately?
Problem
So you want to log the stdout and stderr (separately) of a process or subprocess, without the output being different from what you'd see in the terminal if you weren't logging anything.
Seems pretty simple no? Well unfortunately, it appears…

J.J
- 3,459
- 1
- 29
- 35
33
votes
4 answers
How do I read the output of a child process without blocking in Rust?
I'm making a small ncurses application in Rust that needs to communicate with a child process. I already have a prototype written in Common Lisp. I'm trying to rewrite it because CL uses a huge amount of memory for such a small tool.
I'm having some…

jkiiski
- 8,206
- 2
- 28
- 44
32
votes
5 answers
Final output on slave pty is lost if it was not closed in parent. Why?
I wrote and maintain a program rlwrap that uses a pseudo-terminal to communicate with a child process. Pseudo-terminals (ptys) are found in all Unix(-like) systems, but they behave slightly differently on different platforms.
Case in point: In…

Hans Lub
- 5,513
- 1
- 23
- 43
28
votes
3 answers
Detecting when a child process is waiting for input
I'm writing a Python program for running user-uploaded arbitrary (and thus, at the worst case, unsafe, erroneous and crashing) code on a Linux server. The security questions aside, my objective is to determine, if the code (that might be in any…

miikkas
- 818
- 1
- 8
- 25
27
votes
1 answer
Why use -T with ssh
To test ssh I read you need to use something like ssh -T user@domain.com:
According to man ssh:
-T Disable pseudo-terminal allocation.
-t Force pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on…

Snowcrash
- 80,579
- 89
- 266
- 376
26
votes
2 answers
Piping data to Linux program which expects a TTY (terminal)
I have a program in Linux which refuses to run if its stdin/stdout is not a TTY (terminal device). Is there an easy-to-use tool which will create a PTY, start the program with the newly created TTY, and copy all data over stdin/stdout?
The use case…

pts
- 80,836
- 20
- 110
- 183
26
votes
3 answers
Run command and get its stdout, stderr separately in near real time like in a terminal
I am trying to find a way in Python to run other programs in such a way that:
The stdout and stderr of the program being run can be logged
separately.
The stdout and stderr of the program being run can be
viewed in near-real time, such that if the…

J.J
- 3,459
- 1
- 29
- 35
22
votes
3 answers
Why does running a background task over ssh fail if a pseudo-tty is allocated?
I've recently run into some slightly odd behaviour when running commands over ssh. I would be interested to hear any explanations for the behaviour below.
Running ssh localhost 'touch foobar &' creates a file called foobar as expected:
[bob@server…

Floating Octothorpe
- 535
- 5
- 11
22
votes
6 answers
node-gyp error while doing npm install
I am doing npm install from a project and I am getting this wierd error in node-gyp.
> pty.js@0.2.3 install /home/charizard/Open/terminal-codelearn/node_modules/pty.js
> node-gyp rebuild
npm http GET https://registry.npmjs.org/commander
npm http…

Charizard_
- 1,215
- 1
- 9
- 20
20
votes
6 answers
Connection to the terminal's pty host process is unresponsive
After installing VSCode, I started receiving this certain notification saying
The connection to the terminal's pty host process is unresponsive, the terminals may stop working.
The notification won't disappear until I click the restart button.…

AstrooKai.
- 201
- 1
- 2
- 6
18
votes
1 answer
difference between pty and a pipe
I have been reading about ptys from this page's example: http://www.rkoucha.fr/tech_corner/pty_pdip.html. I have two questions:
What is the difference, or the most important difference, between using a pty and using a pipe? From what I have read,…

kprincipe
- 331
- 2
- 10
16
votes
3 answers
How to use pseudo-terminals in Linux with C?
I'm trying to figure out how to use pseudo-terminal's in linux, essentially I want to create a telnetd clone, something I mentioned in an earlier question.
I understand the concept of master and slave terminal, and I have a basic grasp on how to use…

Irresponsible Newb
- 603
- 2
- 7
- 15
14
votes
3 answers
Python: when to use pty.fork() versus os.fork()
I'm uncertain whether to use pty.fork() or os.fork() when spawning external background processes from my app. (Such as chess engines)
I want the spawned processes to die if the parent is killed, as with spawning apps in a terminal.
What are the ups…

Thomas Ahle
- 30,774
- 21
- 92
- 114