Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Perl ignores lines with bold characters from a pipe on Windows (source not dest)

by tye (Sage)
on Mar 03, 2007 at 03:14 UTC ( [id://603020]=note: print w/replies, xml ) Need Help??


in reply to Perl ignores lines with bold characters from a pipe on Windows

I strongly suspect that the answer that explains this will actually be to the question "Why doesn't mycmd write the lines that would contain bold characters when I launch it these ways from Perl?".

The third case is especially indicative as Perl isn't doing any of the "problem" I/O so how can Perl be ignoring any lines? Perl isn't between mycmd and test_perl3 so the contents of test_perl3 have nothing to with Perl's I/O features nor could Perl "ignore" things and have any impact on what ends up in test_perl3.

You need to discard your theory that Perl is ignoring lines and look at the problem again. There are other test cases you can try (running mycmd vs. perl -e"system('mycmd')", for example). You should look for more information about mycmd also.

- tye        

Replies are listed 'Best First'.
Re^2: Perl ignores lines with bold characters from a pipe on Windows (source not dest)
by kingkongrevenge (Scribe) on Mar 03, 2007 at 05:01 UTC

    Probably correct. Unfortunately I have no idea how mycmd might be analyzing its parent process. To my knowledge no relevant environment variables are set either from the shell or from Perl. Mycmd is closed source, so I'm likely at a dead end.

    How can I check that Perl isn't setting any environment variables?

      How can I check that Perl isn't setting any environment variables?

      AFAIK, it doesn't. If you don't, that is. OTOH under *NIX it is possible to detect whether a file descriptor is connected to a tty or not, which is often used to "understand" whether a program's STDOUT is being piped or redirected to a file or not. (This is what e.g. ls(1) does under recent releases of Linux, at least: it acts like ls -1 if you pipe it to something else, and similarly if you set --color=auto it will print coloured output on the terminal, but will disable it when piping or redirecting to a file - in fact the switch is set by default in many distros.) Maybe under windows it's the same. Let me see:

      C:\temp>perl -le "open F, '>F'; print -t *F; print -t *STDOUT" 1

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://603020]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-25 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found