Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to send data to another process's standard input under Mac OS?

Tags:

macos

stdin

I was wondering if there was an API, however obscure it would be, that would allow someone to send data to another process's stdin stream under Mac OS X. Under Linux, if I remember correctly, you can use the filesystem in /proc to access these streams (with the correct permissions, of course).

I dunno. Mach ports, anyone?

like image 231
zneak Avatar asked Aug 21 '10 01:08

zneak


People also ask

How do you submit an input to a running process?

It is possible to send input text to a running process without running the screen utility, or any other fancy utility. And it can be done by sending this input text to the process' standard input "file" /proc/PID#/fd/0 . However, the input text needs to be sent in a special way to be read by the process.

Can a process write to its own Stdin?

You can't "push to own stdin", but you can redirect a file to your own stdin.


1 Answers

Just a thought, but couldn't you make a pipe, and redirect that (named) pipe to the standard input of the process when starting that process?

Roughly somethink like

mkfifo MYPIPE
Prog < MYPIPE
echo "test" > MYPIPE
like image 133
extraneon Avatar answered Nov 12 '22 00:11

extraneon