unix command displayed when using PIPES with open. 
Author Message
 unix command displayed when using PIPES with open.

Quote:

> When i execute the following source code, the command being executed
> by the pipe is being displayed on the screen... how do i stop
> this from happening.... without re-directing it..... not even to bit-heaven
> (/dev/null).... if it's done in C, it doesn't happen.

Ummm... did you even read your code?  There's a 'print "$syscmd\n"' in
there, you know.

Quote:
> #!/usr/bin/perl -w
> use strict;
> use 5.004;

> my( $syscmd ) = "prs -e -d\":M: :I: :D: by :P:\" $ENV{'PROJECTDIR'}/SCCS/";

> my( $line );

> print "$syscmd\n";

  ^^^^^

Right here.  Now, why on *earth* would that statement print the value of
$syscmd followed by a newline?  It just doesn't make sense... >smirk<

Quote:
> open( FILEPIPE, "$syscmd|" ) or die "Unable To Open Pipe\n";

> close( FILEPIPE );

BTW it's a good idea to check $? after closing a pipe -- it's only after
closing that you find out if the program being spawned wasn't found or
wasn't executable (or something).  'open' failure usually means
"couldn't fork" (which you would be able to find out if you had included
$! in your 'die' after 'open' above).

        Greg
--

Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, {*filter*}ia, USA  20191-5434               fax: +1-703-620-0913



Mon, 16 Jul 2001 03:00:00 GMT  
 unix command displayed when using PIPES with open.
HAHA....  what a day I've had......... sorry Greg.... this must go down as
the
stupidest thing in my professional career....

It's one of those days where you need a second set of eyes to look at your
mistakes........   I was working on something at work when I should have
been
working on other things.... I kept switching between what I was meant to
have been
working on... and getting a little pissed at why it would work.........

I was to busy looking at the open() onwards..... well that's my lame excuse.

Is there any cure for code blindness?  If not... I'm finished.

Now I look as stupid as I've been feeling for a while.

Thanks Greg!

Quote:


>> When i execute the following source code, the command being executed
>> by the pipe is being displayed on the screen... how do i stop
>> this from happening.... without re-directing it..... not even to
bit-heaven
>> (/dev/null).... if it's done in C, it doesn't happen.

>Ummm... did you even read your code?  There's a 'print "$syscmd\n"' in
>there, you know.

>> #!/usr/bin/perl -w
>> use strict;
>> use 5.004;

>> my( $syscmd ) = "prs -e -d\":M: :I: :D: by :P:\"

$ENV{'PROJECTDIR'}/SCCS/";

- Show quoted text -

Quote:

>> my( $line );

>> print "$syscmd\n";
>  ^^^^^

>Right here.  Now, why on *earth* would that statement print the value of
>$syscmd followed by a newline?  It just doesn't make sense... >smirk<

>> open( FILEPIPE, "$syscmd|" ) or die "Unable To Open Pipe\n";

>> close( FILEPIPE );

>BTW it's a good idea to check $? after closing a pipe -- it's only after
>closing that you find out if the program being spawned wasn't found or
>wasn't executable (or something).  'open' failure usually means
>"couldn't fork" (which you would be able to find out if you had included
>$! in your 'die' after 'open' above).

>        Greg
>--

>Corporation for National Research Initiatives
>1895 Preston White Drive                      voice: +1-703-620-8990 x287
>Reston, {*filter*}ia, USA  20191-5434               fax: +1-703-620-0913



Mon, 16 Jul 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Bug in perl opening a UNIX pipe

2. piping command output to open()

3. Opening a pipe to a command

4. open a piped command including stderr

5. open COMMAND with a pipe

6. open command that pipes both in and out

7. Killing a pipe-opened command in Win32?

8. Piping a variable value to a UNIX command

9. Piping to and from a unix command

10. unix command pipes

11. piping data through unix command

12. Perl's open command on unix files

 

 
Powered by phpBB® Forum Software