I have a Python script that does a fork/exec, so the parent process
can get the child's PID and monitor /proc/PID/stat (on a CentOS
system). Most of my processes' command lines are straightforward
enough to do this with, but I have a handful that use < on the command
line, eg
../gobmk_base.linux_x86 --quiet --mode gtp < 13x13.tst
The only thing I could really think of to try was
os.execv("./gobmk_base.linux_x86", ["./gobmk_base.linux_x86",
"--quiet", "--mode", "gtp", "<", "13x13.tst"])
but this apparently doesn't work. Is there some other way to
accomplish what I'm going for?
Thanks,
-dan 3 2152
On Nov 26, 7:58 pm, "Dan Upton" <up...@virginia.eduwrote:
I have a Python script that does a fork/exec, so the parent process
can get the child's PID and monitor /proc/PID/stat (on a CentOS
system). Most of my processes' command lines are straightforward
enough to do this with, but I have a handful that use < on the command
line, eg
./gobmk_base.linux_x86 --quiet --mode gtp < 13x13.tst
The only thing I could really think of to try was
os.execv("./gobmk_base.linux_x86", ["./gobmk_base.linux_x86",
"--quiet", "--mode", "gtp", "<", "13x13.tst"])
but this apparently doesn't work. Is there some other way to
accomplish what I'm going for?
Thanks,
-dan
IIRC,
if os.fork() == 0:
new_stdin = os.open('13x13.tst')
os.dup2(new_stdin, sys.stdin.fileno())
os.close(new_stdin)
os.execv("./gobmk_base.linux_x86", ["./gobmk_base.linux_x886", "--
quiet", "--mode", "gtp"])
On Nov 27, 12:09 am, hdante <hda...@gmail.comwrote:
On Nov 26, 7:58 pm, "Dan Upton" <up...@virginia.eduwrote:
I have a Python script that does a fork/exec, so the parent process
can get the child's PID and monitor /proc/PID/stat (on a CentOS
system). Most of my processes' command lines are straightforward
enough to do this with, but I have a handful that use < on the command
line, eg
./gobmk_base.linux_x86 --quiet --mode gtp < 13x13.tst
The only thing I could really think of to try was
os.execv("./gobmk_base.linux_x86", ["./gobmk_base.linux_x86",
"--quiet", "--mode", "gtp", "<", "13x13.tst"])
but this apparently doesn't work. Is there some other way to
accomplish what I'm going for?
Thanks,
-dan
IIRC,
if os.fork() == 0:
new_stdin = os.open('13x13.tst')
os.dup2(new_stdin, sys.stdin.fileno())
os.close(new_stdin)
os.execv("./gobmk_base.linux_x86", ["./gobmk_base.linux_x886", "--
quiet", "--mode", "gtp"])
Maybe a sys.stdin.flush() just to be sure ?
./gobmk_base.linux_x86 --quiet --mode gtp < 13x13.tst
The only thing I could really think of to try was
os.execv("./gobmk_base.linux_x86", ["./gobmk_base.linux_x86",
"--quiet", "--mode", "gtp", "<", "13x13.tst"])
but this apparently doesn't work. Is there some other way to
accomplish what I'm going for?
Thanks,
-dan
IIRC,
if os.fork() == 0:
new_stdin = os.open('13x13.tst')
os.dup2(new_stdin, sys.stdin.fileno())
os.close(new_stdin)
os.execv("./gobmk_base.linux_x86", ["./gobmk_base.linux_x886", "--
quiet", "--mode", "gtp"])
Maybe a sys.stdin.flush() just to be sure ?
Thanks, that did the trick (well, os.open('13x13.tst', os.O_RDONLY),
but you know... close enough). This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Benoit Dejean |
last post by:
hello, i have a question about forking processes
atm, i have some code which i want to rewrite
os.system("cd ~ && exec " + cmd + " & disown")
i want to remove this os.system call
|
by: comp.lang.tcl |
last post by:
The TCL command I am using will do a command-line action on a PHP
script:
set cannotRunPHP
I have to do it this way as both the TCL script and the PHP script run
as CLI. However, "info.php"...
|
by: anshul1806 |
last post by:
hi all ,
I am wondering why a call to fork fails to print some statements in
the child.
It works fine when terminal is defualt for O/p .
in case i try redirection it fails to redirect...
|
by: Andreas.Burman |
last post by:
Hi
I call a program through exec that can take a long time to execute.
This is fine but I would like to show some kind of animation or
something while the program is running and when it is...
|
by: thrillseekersforever |
last post by:
The questions(A&B) are to fine no# of process running from the below
codes. However, I couldn't decipher the solution. Will someone please
throw some light on this? Thanks a lot!!
A]
void...
|
by: rickcasey |
last post by:
I wonder if anyone has experienced something like this, as it seems
truly bizarre and is causing me to tear out my hair (what little there
is left of it)....
The exec() function just suddenly...
|
by: Rafael Giannetti Viotti |
last post by:
Hi,
I am working with the subprocess.py module in Python 2.4.4 and I am
confused about it's functionality. It uses the standard pipe-fork-exec
method to start a subprocess:
# create pipes
...
|
by: Maarten |
last post by:
Howdy,
Recently I switched from a Windows PC to Mac OS-X 10.5 (php v5.2.6) and
I have a little problem with one function within my cd-management script.
For extracting a bit of info from my...
|
by: boddah |
last post by:
Hi all,
I'm writing a manager application (Linux/C++) that'll spawn 2 instances of a program (myApp). The myApp program needs to stay alive after being spawned (both instances) so a 3rd party...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |