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
14
votes
4 answers
Ruby on Linux PTY goes away without EOF, raises Errno::EIO
I'm writing some code which takes a file, passes that file to one of several binaries for processing, and monitors the conversion process for errors. I've written and tested the following routine on OSX but linux fails for reasons about which I'm…

voxobscuro
- 2,132
- 1
- 21
- 45
13
votes
5 answers
Use python's pty to create a live console
I'm trying to create an execution environment/shell that will remotely execute on a server, which streams the stdout,err,in over the socket to be rendered in a browser. I currently have tried the approach of using subprocess.run with a PIPE. The…

Ishan Khare
- 1,745
- 4
- 28
- 59
13
votes
2 answers
How can I detect when someone opens the slave side of a pty (pseudo-terminal) in Linux?
Having more than one process read from a serial device (/dev/ttyXX) makes it so that both processes can't get all of the data -- the data will be split between them in some way. I'd like to write a program that reads from a serial device, creates…

Nate Sanders
- 133
- 1
- 4
12
votes
1 answer
Why is Linux's pty driver replacing VEOFs with NULs?
It seems that the pty driver on Linux is replacing VEOF characters (^D, \4) with NUL bytes (\0) in the data already written from the master side if the terminal settings are changed with tcsetattr(TCSANOW) to non-canonical mode before reading it on…
user10678532
12
votes
5 answers
python pty.fork - how does it work
http://docs.python.org/library/pty.html says -
pty.fork()¶
Fork. Connect the child’s controlling terminal to a pseudo-terminal. Return value is (pid, fd). Note that the child gets pid 0, and the fd is invalid. The parent’s return value is…

webminal.org
- 44,948
- 37
- 94
- 125
12
votes
3 answers
What is the equivalent of unbuffer program on Windows?
Hi according to this post, unbuffer connects to a command via a pseudo-terminal (pty), which makes the system treat it as an interactive process, therefore not using any stdout buffering.
I would like to use this function on Windows. May I know what…

userpal
- 1,483
- 2
- 22
- 38
11
votes
6 answers
How to send Ctrl-C control character or terminal hangup message to child process?
I have a child process which runs in a pseudo terminal. The parent process does not run as root, but the child process does, through su or sudo. Because of this it is not possible to send a signal to the child process to force it to exit. I want to…

Hongli
- 18,682
- 15
- 79
- 107
11
votes
3 answers
How to implement Ctrl-C and Ctrl-D with openpty?
I am writing a simple terminal using openpty, NSTask and NSTextView. How are CtrlC and CtrlD supposed to be implemented?
I start a shell like this:
int amaster = 0, aslave = 0;
if (openpty(&amaster, &aslave, NULL, NULL, NULL) == -1) {
…

alltom
- 3,162
- 4
- 31
- 47
10
votes
2 answers
Pseudoterminal master reads what it has just written
I'm working on a project that interfaces "virtual devices" (python processes) that use serial port connections with real devices that also use serial ports, and I'm using pseudoterminals to connect several(more than 2) of these serial-port…

bradreaves
- 1,463
- 2
- 14
- 16
10
votes
1 answer
PTY/TTY - What Can't You Do With Only Slave FD
Question:
If I have a pty or tty master/slave pair, what can I not do with it if I only have the slave node's file descriptor? Or, put another way: what can I only do if I have the master node's file descriptor?
My Current Understanding:
I grok the…

mtraceur
- 3,254
- 24
- 33
9
votes
3 answers
How to capture inputs and outputs of a child process?
I'm trying to make a program which takes an executable name as an argument, runs the executable and reports the inputs and outputs for that run. For example consider a child program named "circle". The following would be desired run for my…

Asocia
- 5,935
- 2
- 21
- 46
9
votes
1 answer
Errors installing pty.js (node) on OS X
I have run into an unusal problem when trying to install pty.js using node:
If I run npm install pty.js I receive this error:
> node-gyp rebuild
CXX(target) Release/obj.target/pty/src/unix/pty.o
../src/unix/pty.cc:487:10: error: use of undeclared…

Otis Wright
- 1,980
- 8
- 31
- 53
9
votes
3 answers
Python reading and writing to tty
BACKGROUND: If you want, skip to the problem section
I am working on a front end for test equipment. The purpose of the front end is to make it easier to write long test scripts. Pretty much just make them more human readable and writable.
The…
user3002273
8
votes
3 answers
Python terminal emulation
I'd like to have an xterm-compatible virtual terminal running inside a Python app.
I'll need to run ncurses-based applications inside it, feed it with user's input and read its output.
So far I've found python-vte, but it only provides a GTK+ widget…

Eugene Pankov
- 856
- 1
- 15
- 30
8
votes
1 answer
forkpty - socket
I'm trying to develop a simple "telnet/server" daemon which have to run a program on a new socket connection.
This part working fine.
But I have to associate my new process to a pty, because this process have some terminal capabilities (like a…

Alexxx
- 766
- 1
- 11
- 19