Questions tagged [pty]

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.

362 questions
0
votes
1 answer

Can someone explain this Python code for me?

This code create pty (pseudo-terminals) in Python. I have commented the parts that I do not understand import os,select pid, master_fd =os.forkpty() #I guess this function return the next available pid and fd args=['/bin/bash'] if pid == 0:#I have…
Gray
  • 227
  • 1
  • 3
  • 12
0
votes
0 answers

how to block write of slave pty

Assume we have a code pid_t pid = forkpty(&fd, &name, NULL, NULL); if (pid < 0) return; if (pid == 0) { // child process } else { // parent process to handle pty master } How to block the write in subprocess (pty slave) until parent process…
0
votes
1 answer

ruby PTY spawn method

I used PTY.spawn to open an Excel file using the gem "roo" but it shows only errors INPUT_FILE = 'sample.xls' begin PTY.spawn("Roo::Spreadsheet.open '#{INPUT_FILE}'") do |r_f,w_f,pid| r_f.each {|line| puts line} end rescue…
Siva KB
  • 327
  • 5
  • 18
0
votes
0 answers

.How do pseudo-terminal restore the character into a complete command when I enter one character every time?

I'm developing pseudo-terminal application using linux c .How do "/dev/ptmx" restore the character into a complete command , when I enter one character to STDIN_FILENO every time. For example: write (master_fd, "l", 1); write (master_fd, "s",…
ttworkhard
  • 283
  • 6
  • 14
0
votes
0 answers

usage of pseudo terminal -- C

I created a pThread with a specific session number. If the pThread is spawned I try to get another process running the pseudo terminal launched using openpty. Here is some part of the code: if…
pistal
  • 2,070
  • 8
  • 39
  • 58
0
votes
1 answer

Run a command without PTY

I am writing a test script and need to gather "free -m" output at some interval at background. However, watch cmd sends control sequences to delete old output, thinking it is in a terminal. But I don't want that, I want the values throught the…
Mustafa
  • 9,075
  • 7
  • 62
  • 109
0
votes
1 answer

Linux PTYs as module, but no signals

I wrote an embedded application (a vt52 terminal emulator) running on a linux rom based system with no built in ptys; and Unix98 broken. But Since I must have ptys for a terminal to work ... I manually compiled the old style BSD pty's to be a…
0
votes
1 answer

NSTask for SSH using PTY

I'm trying to write an app that will programmatically log in to a remote device using SSH much like an expect script (I know I can use expect but I would like to do this in Obj-c). I have researched a lot on this and know that I need to use a pty. …
0
votes
0 answers

Why "ls" is not colored after forkpty()

Why output of ls executed here is not colored? #include #include #include #include #include int main(int argc, char **argv ) { termios termp; winsize winp; int amaster; char name[128]; …
exebook
  • 27,243
  • 27
  • 105
  • 196
0
votes
1 answer

Read() from file descriptor hangs

Hey, hopefully this should be my last PTY-related question and I can move onto more exciting issues. (c; Here's a set of small functions I have written for creating and reading/writing to a pty: http://pastebin.com/m4fcee34d The only problem is…
Klaus Fiedler
0
votes
1 answer

Python Popen pty, AttributeError: 'list' object has no attribute 'rstrip'

I have two problems with the below code. Problem 1 is that pty does not work on Windows, works on MAC, but I need this application to run on all platforms. Problem 2 is when run this I get AttributeError: 'list' object has no attribute 'rstrip', not…
speedyrazor
  • 2,645
  • 5
  • 27
  • 47
0
votes
1 answer

Issuing commands to psuedo shells (pty)

I've tried to use the subprocess, popen, os.spawn to get a process running, but it seems as though a pseudo terminal is needed. import pty (master, slave) = pty.openpty() os.write(master, "ls -l") Should send "ls -l" to the slave tty... I tried…
user791953
  • 609
  • 2
  • 6
  • 20
0
votes
1 answer

Python + SSH Password auth (no external libraries or public/private keys)?

So I'm aware that you can use Pexpect to solve the issue but i'd like to not rely on additional libraries to solve the issue other than those supplied with Python3. I'm also aware the generating public keys and allowing them on the remote host is…
Torxed
  • 19,906
  • 13
  • 73
  • 114
0
votes
1 answer

Ruby: Read from PTY master_io hangs

I'm using Ruby and I have the following code for ssh-ing into a router and running a series of commands that are stored in an arrary: result = PTY.open do |masterIO, slaveFile| r, w = IO.pipe slaveFile.raw! pid = spawn(sshCommand,…
Justin Smith
  • 149
  • 2
  • 9
0
votes
1 answer

unable to run script on other pty - solaris

When I am running a bash script on a different terminal , I see an error, bash command not found, whereas general commands work fine my script reads input for a name and runs a query against a db and returns output OS solaris best regards dpn