| 
	
 | 
 Posted by ZeldorBlat on 07/19/07 16:33 
On Jul 18, 6:26 pm, qazwart <qazw...@gmail.com> wrote: 
> I am reading from a "cvs rlog" command, and I need both the STDOUT and 
> STDERR. Unfortunately, something very strange is happening. If I do 
> this: 
> 
>     $cmd = "$cvs_cmd -q rlog -NS -r$from_label::$to_label neo 2>&1"; // 
> Hard coded module 
>     DEBUG ("if (!($cvs_fh = popen(\"$cmd\", 'r'))) {"); 
>     if (!($cvs_fh = popen("$cmd", 'r'))) { 
>         generate_error("Canot open command \"$cmd\" for reading"); 
>     } 
>     $exam_file_flag = false; 
>     $inside_revision_flag = false; 
>     $inside_comment_flag = false; 
>     print "Generating Initial Release Information: "; 
>     flush(); 
>     while($line = fgets($cvs_fh)) { 
>         DEBUG ("....line = \"$line\""); 
> 
> I get the combined STDOUT and STDERR in my while loop. However if I do 
> this: 
> 
>     $cvs_module = "neo" 
>     $cmd = "$cvs_cmd -q rlog -NS -r$from_label::$to_label $cvs_module 
> 2>&1"; //Use variable for module 
>     DEBUG ("if (!($cvs_fh = popen(\"$cmd\", 'r'))) {"); 
>     if (!($cvs_fh = popen("$cmd", 'r'))) { 
>         generate_error("Canot open command \"$cmd\" for reading"); 
>     } 
>     $exam_file_flag = false; 
>     $inside_revision_flag = false; 
>     $inside_comment_flag = false; 
>     print "Generating Initial Release Information: "; 
>     flush(); 
>     while($line = fgets($cvs_fh)) { 
>         DEBUG ("....line = \"$line\""); 
> 
> I don't get STDERR  in my while loop. 
> 
> Note the "DEBUG" line. This is a little routine I wrote to help me see 
> what is going on. Here is the output of the DEBUG line in the first 
> code example: 
> 
> DEBUG: if (!( = popen("/usr/local/bin/cvs -d :pserver:build@aladdin:/ 
> tools/CVSROOT -q rlog -NS -rNEO-199::NEO-210 neo 2>&1", 'r'))) { 
> 
> Here is the output of the "DEBUG" line in the second code example: 
> 
> DEBUG: if (!( = popen("/usr/local/bin/cvs -d :pserver:build@aladdin:/ 
> tools/CVSROOT -q rlog -NS -rNEO-199::NEO-210 neo 2>&1", 'r'))) { 
> 
> Is there something I should be looking for? 
 
Before running the command echo out the value of $cmd to make sure it 
is what you think it is.
 
  
Navigation:
[Reply to this message] 
 |