471,075 Members | 911 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,075 software developers and data experts.

Capture file descriptors while running an external program

>I have a problem with the module subprocess!
>The problem is that the external software that I am running under
subprocess.Popen opens stdin, stdout, stderr, and other file descriptors to
write and read in the hard drive.
As many other programs...
>I know how to capture stdin, stdout and stderr, what I cannot do is to capture
the other file-descriptors. Is there any way to wrap those non-standard file
descriptors and make them write and read from a specific object that I define?
I know that I can use tmp files to do that, but i would like something running
without tmp files.
I'm not sure what you mean by "non-standard file descriptors". The
other program is free to open, read, write, etc any file he wants -
are you trying to trap any file operation it may want to do?
You *could* do such things -google for "code injection" and "API
hooking"- but I doubt it's what you really want.

Gabriel Genellina
Softlab SRL

Hi Gabriel!

When I wrote "non-standard file descriptors", I meant the file descriptior which
are pointed to files in the hardrive.
What I would like to do is not to trap any file operation, but instead intercept
that file operation, i.e. I would like the output of the external program to
don't be writen in a file (its normal behavior), but instead be sent to any
variable in my program.
I know the name of the file where the external program will write the output.. I
pass its name along the command line.

Joao Figueiras

__________________________________________________ _________________

O SAPO já está livre de vírus com a Panda Software, fique você também!
Clique em: http://antivirus.sapo.pt

Nov 25 '06 #1
0 1229

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Kiran | last post: by
reply views Thread by j101 | last post: by
3 posts views Thread by RICHARD BROMBERG | last post: by
5 posts views Thread by yinglcs | last post: by
13 posts views Thread by Jim Langston | last post: by
2 posts views Thread by DJ Dharme | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.