|
Home > Archive > Unix administration > March 2005 > How to write to stdin of another process?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to write to stdin of another process?
|
|
|
| Hello
if I have the PID of another already running process is it possible to write
to its stdin? I guess it is possible so the question is HOW?
I managed to send data to the stdin file of the process and it was displayed
in the console where the process was running but it wasn't actually read by
the process 
Thank you in advance
--
There are 10 types of people - those who understand binary and those that
don't
| |
| Jeremiah DeWitt Weiner 2005-03-22, 6:08 pm |
| Paul <pg_x@yahoo.com> wrote:
> if I have the PID of another already running process is it possible to write
> to its stdin? I guess it is possible so the question is HOW?
To an arbitrary process, which was not started in any special way?
No. There are ways to do it if you can control how the process starts,
though. For example, you could create a FIFO and make the process take
input from it, then write data to the FIFO. Using "screen" might also
do what you want, depending on what your requirements are.
> I managed to send data to the stdin file of the process and it was displayed
> in the console where the process was running but it wasn't actually read by
> the process 
Correction: you managed to send data to the terminal which was
stdin and stdout of the process. That's not the same thing as sending
it to the stdin of the process, as you discovered.
Xposted and f'ups set, since this is not really an admin-type question.
JDW
| |
| Bill Marcum 2005-03-23, 6:09 pm |
| On Tue, 22 Mar 2005 11:40:44 +0200, Paul
<pg_x@yahoo.com> wrote:
> Hello
> if I have the PID of another already running process is it possible to write
> to its stdin? I guess it is possible so the question is HOW?
I guess it isn't possible unless you start the other process with input
directed to a named pipe.
--
If you call tech support today, wish them a happy Pakistan Day
| |
| Doug Freyburger 2005-03-24, 5:52 pm |
| Paul wrote:
>
> if I have the PID of another already running process is it possible
to write
> to its stdin? I guess it is possible so the question is HOW?
I'm not sure it's possible using normal means, but
on Solaris the place I would start is the
pseudo-filesystem /dev/fd. It has the file
descriptors or open files by process. Next place to
look is the pseudo-filesystem /proc. Different
versions give different amounts of stuff, so the
Linux one has a lot more than the Solaris one.
| |
| Barry Margolin 2005-03-24, 8:48 pm |
| In article <1111687114.841878.45460@z14g2000cwz.googlegroups.com>,
"Doug Freyburger" <dfreybur@yahoo.com> wrote:
> Paul wrote:
> to write
>
> I'm not sure it's possible using normal means, but
> on Solaris the place I would start is the
> pseudo-filesystem /dev/fd. It has the file
> descriptors or open files by process. Next place to
> look is the pseudo-filesystem /proc. Different
> versions give different amounts of stuff, so the
> Linux one has a lot more than the Solaris one.
That won't solve the problem. If you write to one of these, you'll send
your output to the same device that the process would when writing to
that descriptor. It still won't let you feed *input* to the process.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
|
|
|
|
|