Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Fellow monks, I have need of your wisdom.

I'm trying to write a Perl script that wraps around an interactive Python script (it's the "" for Google's code review service). My script needs to get the output given to the user so that it can parse out the issue URL generated by

I was thinking I would just do something like this:

my $output = `/script/ @ARGV`;

I was expecting that this would run and print what prints to the user's terminal so they can see it, and when they're prompted to fill out information, it would pass their input through to directly.

But the backticks don't let STDOUT sneak through to the terminal, so then I tried using system() with "tee" to copy the STDOUT to a file which my script could read after:

system("/script/ @ARGV | tee temp.tee"); my $output = `cat temp.tee`; # not really, did a read() instead

But this didn't work either. No output from was given on my terminal; it was obviously hanging, waiting for input, but didn't give any output unless I made the exit normally (i.e. answering "no" when it prompted me about svn files that aren't managed by svn at the beginning). It may be a line buffering issue in; how could I force autoflush on it if this is the case?

In reply to Wrap around an interactive python script by Kirsle

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2021-10-24 10:27 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (89 votes). Check out past polls.