This is a discussion on Perl and Apache, running system commands... within the Windows Web Servers forums, part of the Web Server and Related Forums category; I need to make a system call within a cgi script, and I am having some trouble. I know that ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I need to make a system call within a cgi script, and I am having some
trouble. I know that I have done this before, but for some reason, when I make the call, things hang, and the debug just before my system call gets printed, but the debug after never gets printed. I made s short .pl script, which works fine when I call "perl system.pl" at the command prompt. system.pl: #!/usr/local/bin/Perl/bin/perl.exe -w my $SUCCESS = 0; my $cmd = "notepad.exe \"error.log\""; (system($cmd) == $SUCCESS) or print("Notepad failed: $!\n"); Now, within the confines of my cgi script (running win32 with apache), I am trying ($ME is defined to "filename.cgi:"): don_common'log_to_file($msg_log, "$ME about to make notepad call"); my $cmd = "notepad.exe \"error.log\""; (system($cmd) == $SUCCESS) or don_common'log_to_file("notepad failed: $!\n"); don_common'log_to_file($msg_log, "$ME just made notepad call"); In my log file, I get the following output: filename.cgi: about to make notepad call Any ideas? I even tried to put a copy of notepad.exe in my cgi-bin directory. The error.log is also in the same directory. Thanks, -Kevin |
|
|||
|
Even more interesting, is that notepad is apparently being called,
since it is in the process list, but the gui for notepad never gets raised to the point to where it is displayed anywhere. Of course after this point, Apache will wait for notepad to exit, which never happens, and at some point goes into the error log when Apache terminates the thread. So, I tried closing STDIN and STDOUT, but it makes no difference. Any ideas? On Jan 29, 3:34 pm, "gocaveman" <kevinwh...@bellsouth.net> wrote: > I need to make a system call within a cgi script, and I am having some > trouble. I know that I have done this before, but for some reason, > when I make the call, things hang, and the debug just before my system > call gets printed, but the debug after never gets printed. > > I made s short .pl script, which works fine when I call "perl > system.pl" at the command prompt. > system.pl: > #!/usr/local/bin/Perl/bin/perl.exe -w > my $SUCCESS = 0; > > my $cmd = "notepad.exe \"error.log\""; > (system($cmd) == $SUCCESS) or print("Notepad failed: $!\n"); > > Now, within the confines of my cgi script (running win32 with apache), > I am trying ($ME is defined to "filename.cgi:"): > don_common'log_to_file($msg_log, "$ME about to make notepad call"); > my $cmd = "notepad.exe \"error.log\""; > (system($cmd) == $SUCCESS) or don_common'log_to_file("notepad failed: > $!\n"); > don_common'log_to_file($msg_log, "$ME just made notepad call"); > > In my log file, I get the following output: > filename.cgi: about to make notepad call > > Any ideas? I even tried to put a copy of notepad.exe in my cgi-bin > directory. The error.log is also in the same directory. > > Thanks, > > -Kevin |