![]() |
Executing two scripts concurrently on your home machine
I'd like to know how I can run the same script twice (on the command line or even in my browser) so that I can get overlapping outputs on my windows machine. So, for instance if the script were something simplistic like the following:[PHP]<?php
while(true){ fwrite(STDOUT, "Process ID: " . getmypid() . "\n"); sleep(1); } ?>[/PHP]The output in the command line would be something along the lines of: :
Process ID: 3894 |
I would probably write a Perl script (on windows) that creates one or more child processes that each connect to the given URL and download the results to a local, temporary, HTML file. Then, if possible, the script would display the local pages in my default browser for me.
But, why do you want to do this? |
I wanted to do this to test a file locking mechanism. I was actually just sort of hoping it would be some sort of command line input I had to enter. I just opened up to command prompts and typed in the same command, ALT+TAB really quick and got some overlapping instructions. Not the most efficient way to look at the output lol but it JUST met the requirements. Needless to say the file-locking mechanism I was trying to implement didn't work.
|
Sadly the Windows command-line shell is a bit restrictive. Hailing from the days of non-multitasking OSes it doesn't spawn background processes conveniently like Unix shells do. Even its I/O redirection is still pretty poor. I pity people stuck developing and testing on Win32 - it's such a weird, archaic system.
|
| All times are GMT -5. The time now is 3:57 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC