in reply to Program hangs while gathering external program output

Add buffer autoflushing just after the use strict with $|++ see Suffering from Buffering

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

  • Comment on Re: output to screen by hitting return key

Replies are listed 'Best First'.
Re: Re: output to screen by hitting return key
by hdeng419 (Initiate) on Apr 19, 2002 at 01:17 UTC
    I don't see how the article could help. When the Java program runs, D:\dir\javac suveryimport
    it generates:
    RLU: Using PropertyResourceBundle... Record: 1 Result: surveyresponse.jsp Record: 2 Result: surveyresponse.jsp Record: 3 Result: surveyresponse.jsp Record: 4 Result: surveyresponse.jsp Hit return to exit.
    Without hitting the return, it won't return to the Dos prompt. Besides this, when the Java program throws no exception, with the help of hitting, I may get the right output order. If java program thorws exception(encounter error), the output is out of order which means one stream is out through terminal(bufferred), the other stream is out through STDERR (not bufferred). Any idea to walk around the problem?
    run directly from dos prompt: D:\Ema\extension\win32>surveyimport Kazoo.cfg Starting proxy manager. user name = sa RLU: Using PropertyResourceBundle... Record: 1 Result: surveyresponse.jsp java.lang.RuntimeException: Junk after quoted field at rubric.data.DataParser.hasMoreElements(DataParser.java:37) at rubric.data.ImportSurveyData.importFile(ImportSurveyData.java:186) at rubric.data.ImportSurveyData.main(ImportSurveyData.java:83) Hit return to exit. run from perl: D:\emaperl>perl emaperl.pl java.lang.RuntimeException: Junk after quoted field at rubric.data.DataParser.hasMoreElements(DataParser.java:37) at rubric.data.ImportSurveyData.importFile(ImportSurveyData.java:186) at rubric.data.ImportSurveyData.main(ImportSurveyData.java:83) Starting proxy manager. user name = sa RLU: Using PropertyResourceBundle... Record: 1 Result: surveyresponse.jsp Hit return to exit.
      Only a suggestion, but can you close STDIN before calling the Java program? Sometimes the Right Thing happens when reading from a file descriptor you expect to be open, when it isn't. (And sometimes spectacularly the wrong thing happens...)