Doc CPU |
06-07-2012 03:57 PM |
Hi there,
Quote:
Originally Posted by CarT_0x41414141
(Post 4698028)
When does a linux pipe open the next program in the command...
Example command #1
python -c 'raw_input(); print "AAAA"' | netcat localhost 31337
|
AFAIK, the shell first creates a pipe, then creates the two processes (python and netstat) nearly simultaneously, passes the write end of the pipe to the first process (python), and the read end to the second process (netstat). So the two programs run concurrently at the same time, output of one becoming input of the other.
Quote:
Originally Posted by CarT_0x41414141
(Post 4698028)
What is the long version of a pipe '|' ?
|
I'm not sure I understand the question. And I don't know much of python. Almost nothing, to be honest.
Anyway, the strategy must be: - open a pipe
- create the first process, passing it the pipe's file descriptor as stdout
- create the second process, passing it the pipe's file descriptor as stdin
This is abstract enough to be appropriate to nearly any language that offers functions for process control.
[X] Doc CPU
|