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
6
votes
1 answer
To enable parallel build, please add the '/m' switch
I wan to run this sample https://github.com/Gottox/node-webterm , but when i executing the command npm install it shows the error msg.
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
…

Varadha31590
- 371
- 5
- 20
6
votes
2 answers
Writing a Linux Terminal emulator
I'd like to write a x11 terminal emulator, but I don't know how I should spawn and communicate with the shell, is there any basic (pseudo- or C) code for that? like what sort of PTY to create, how to bind the shell to it, what signals I have to…

nonchip
- 1,084
- 1
- 18
- 36
6
votes
1 answer
Process connected to separate pty for stdout and stderr
I'm writing a terminal logging program - think the script command but a bit more featureful. One of the differences is that, whereas script captures stdout, stdin and stderr as one big character stream, I would like to keep them separate and record…

Impredicative
- 5,039
- 1
- 17
- 43
6
votes
2 answers
Possible SSH PAM PTY allocation issue
I have a linux ubuntu server hosted on Amazon EC2. There are around 3000+ linux users created on the system with userid as user_1, user_2 & so on.
Surprisingly users till user_2685 are able to login via ssh to the server. Not beyond that.
I have…

Pocha
- 226
- 4
- 11
6
votes
1 answer
Controlling an interactive command-line utility from a Cocoa app - trouble with ptys
What I'm trying to do
My Cocoa app needs to run a bunch of command-line programs. Most of these are non-interactive, so I launch them with some command-line arguments, they do their thing, output something and quit. One of the programs is…

pmdj
- 22,018
- 3
- 52
- 103
6
votes
1 answer
pty multiplexer
I'm trying to multiplex access to a serial port on linux. I'm working with an embedded system that have only one serial port and it would be nice to have more than one process talking to it.
The common use case is to have:
One main program running…

Marcelo MD
- 1,769
- 1
- 18
- 23
5
votes
2 answers
C Fork a new tty
I have to create a new pair of tty (master and slave) without using forkpty().
In the man of pts(4), it is written that :
When a process opens /dev/ptmx, it gets a file descriptor for a pseudo-terminal master (PTM), and a pseudo-terminal slave…

Jeffrey Muller
- 850
- 1
- 15
- 28
5
votes
2 answers
To run sudo commands on a ec2 instance
I cannot run "sudo su" on my ec2 client , I ssh into the client through a java program and run the command through a program.
I can run commands like "ls" and "ifconfig" though.
I get an error saying "sudo: sorry, you must have a tty to run…

Jaimin Shah
- 271
- 1
- 4
- 9
5
votes
2 answers
Where does this \r\n come from when I redirect STDOUT to a PTY in Perl?
With the following code:
use strict;
use warnings;
use utf8;
use IO::Pty;
use Data::Dump qw(pp);
my $pty = IO::Pty->new;
open *STDOUT, '>&', $pty->slave;
if ( my $pid = open *STDOUT, '|-' ) {
# parent
my $str = "foo\n";
print {*STDERR}…

André Kugland
- 855
- 8
- 20
5
votes
1 answer
Is there anything like Python's pty.fork for Ruby?
I'm trying to port some Python code like the following to Ruby:
import pty
pid, fd = pty.fork
if pid == 0:
# figure out what to launch
cmd = get_command_based_on_user_input()
# now replace the forked process with the command
…

bioneuralnet
- 5,283
- 1
- 24
- 30
5
votes
2 answers
Python: How to peek into a pty object to avoid blocking?
I am using pty to read non blocking the stdout of a process like this:
import os
import pty
import subprocess
master, slave = pty.openpty()
p = subprocess.Popen(cmd, stdout = slave)
stdout = os.fdopen(master)
while True:
if p.poll() != None:
…

Woltan
- 13,723
- 15
- 78
- 104
5
votes
1 answer
How do you write to a pty master Rust
I have created a simple pty setup, however I am unsure on how to actually write to the master or slave sides once it is created. I am also unsure if my setup is correct, because upon inspection, the Stdin, Stdout, and Stderr of the child process for…

Ethalot
- 57
- 6
5
votes
2 answers
How detect assigned terminal device for interactive work
I am writing pager pspg. There I have to solve following issue. After reading from stdin I should to reassign stdin from previous reading from pipe to reading from terminal.
I used
freopen("/dev/tty", "r", stdin)
But it doesn't work, when pager…

Pavel Stehule
- 42,331
- 5
- 91
- 94
5
votes
2 answers
Reading from `forkpty` child process: `ls /` output yields `EIO`
I'm trying to use forkpty to execvp a ls /, and then from the parent process read its output and write to stdout.
I got it working, and running it under Valgrind shows no errors either.
EDIT: Valgrind shows no memory errors. The last read still…

Márcio
- 677
- 8
- 15
5
votes
3 answers
How to redirect a program that writes to tty?
This is the un-redirected output (if you don't know what module is, it doesn't matter much):
$ module help null
----------- Module Specific Help for 'null' -----------------------
This module does absolutely nothing.
It's meant…

Davide
- 17,098
- 11
- 52
- 68