How to write data to existing process’s STDIN from external process?

Your code will not work. /proc/pid/fd/0 is a link to the /dev/pts/6 file. $ echo ‘foobar’ > /dev/pts/6 $ echo ‘foobar’ > /proc/pid/fd/0 Since both the commands write to the terminal. This input goes to terminal and not to the process. It will work if stdin intially is a pipe. For example, test.py is : … Read more

Run interactive Bash with popen and a dedicated TTY Python

This is a solution to run an interactive command in subprocess. It uses pseudo-terminal to make stdout non-blocking(also some command needs a tty device, eg. bash). it uses select to handle input and ouput to the subprocess. #!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import select import termios import tty import … Read more

How to toggle CR/LF in gnu screen?

onlcr is for translating outgoing newlines to carriage returns. stty -F /dev/ttyS0 inlcr will translate incoming newlines to carriage returns. You can run that from another terminal after starting screen to avoid any resetting that screen may do on startup. Unfortunately however, this will only change the problem. You’ll then get only returns and no … Read more

What does TTY mean in the unix ps command?

A TTY is a computer terminal. In the context of ps, it is the terminal that executed a particular command. The abbreviation stands for “TeleTYpewriter”, which were devices that allowed users to connect to early computers. In relation to your situation, the jar creates a virtual terminal named ‘ttys000’ but the IDE does not attach … Read more

How to workaround “the input device is not a TTY” when using grunt-shell to invoke a script that calls docker run?

Remove the -t from the docker run command: docker run $RUN_ENV_FILE -i –rm –user node -v “$PWD”:/app -w /app yaktor/node:0.39.0 $@ The -t tells docker to configure the tty, which won’t work if you don’t have a tty and try to attach to the container (default when you don’t do a -d).

Get terminal size in Go

I just wanted to add a new answer since I ran into this problem recently. There is a terminal package which lives inside the official ssh package https://godoc.org/golang.org/x/crypto/ssh/terminal. This package provides a method to easily get the size of a terminal. width, height, err := terminal.GetSize(0) 0 would be the file descriptor of the terminal … Read more

Pretend to be a tty in bash for any command [duplicate]

There are a number of options, as outlined by several other Stack Overflow answers (see Caarlos’s comment). I’ll summarize them here though: Use script + printf, requires no extra dependencies: 0<&- script -qefc “ls –color=auto” /dev/null | cat Or make a bash function faketty to encapsulate it: faketty () { script -qefc “$(printf “%q ” … Read more

techhipbettruvabetnorabahisbahis forumueduseduseduedueduedusedueduseduedu