|
|
Thread Tools | Rating: | Display Modes |
#1
|
|||
|
|||
Output - Wrong order of returned lines using 'Run Program' to launch Perl scripts
To do some treatments in ClearCase 3.2.1 Patch 3 & 5, I have to execute my commands in perl by launching "ccperl.exe myscript.prl".
So to launch these treatments automatically by Visual Build Pro, I use 'Run Program' action with the command "ccperl.exe myscript.prl". Everything is ok concerning the result of the treatment. The only problem I have is in the log: if I use in my perl script, the 'print' command (like "print my comment") and after the 'system' command to do something, "my comment" will appear at the end of the log, after the description of the 'system' command. So if I want to do this presentation: Print ---------------------------------- Print Name of my program Print Date – Time Print Parameters Print ---------------------------------- System('cleartool.exe DoMySomethingInClearCase') Print End of the treatment – Time I will read in the log: Result of System('cleartool.exe DoMySomethingInClearCase') which could be thousands of lines Print ---------------------------------- Print Name of my program Print Date – Time Print Parameters Print ---------------------------------- Print End of the treatment - Time Or (it depends of the number of lines of the result) Part 1 of the result of System('cleartool.exe DoMySomethingInClearCase') which could be thousands of lines Print ---------------------------------- Print Name of my program Print Date – Time Part 2 of the result of System('cleartool.exe DoMySomethingInClearCase') which could be thousands of lines Print Parameters Part 3 of the result of System('cleartool.exe DoMySomethingInClearCase') which could be thousands of lines Print ---------------------------------- Print End of the treatment - Time Is someone has any idea??? "Le petit frenchy" NB: Sorry for my english ;o) |
#2
|
|||
|
|||
The Run Program action captures and logs stdout/stderr from a process in the same order as it is written, so it appears that the order of output you are experiencing is an effect of ccperl.exe.
|
#3
|
|||
|
|||
But when I launch directly from DOS prompt "ccperl.exe myscript.prl", the result on the screen is ok.
Print ---------------------------------- Print Name of my program Print Date – Time Print Parameters Print ---------------------------------- System('cleartool.exe DoMySomethingInClearCase') Print End of the treatment – Time Could the stdout captured by 'Run Program' action be different from the one of the DOS prompt? Thanks for your help |
#4
|
|||
|
|||
What happens if you use a Run Program command of
%DOSCMD% ccperl.exe myscript.prl |
#5
|
|||
|
|||
Unfortunately, the result is still upside down.
I join you the log. Anyway, thanks a lot for your support. |
#6
|
|||
|
|||
I wouldn't expect VBP to capture output in a different order, but apparently it does in this case. What is ccperl.exe? Is it part of ClearCase? If so, it will be difficult for us to debug since we don't have ClearCase here. Are you able to reproduce with something other than ccperl.exe that we would have access to?
|
#7
|
|||
|
|||
I haven't found another program with similar behaviour, so I do for you a test package (zip send by email cause too big ;o).
files in : - ccperl.exe - ccperl4.exe - ccperlglob.exe - libatriaperl100.dll - test_log_build.prl - test_log_build.bld You don't need to register anything; just let unzip in "C:\Program Files\ccperl" Then, in DOS prompt, type "ccperl test_log_build.prl". You should obtain: --- Beginning of the process at: 18:58 create the file... start the copy... 1 fichier(s) copié(s). start the reading at: 18:58 content of the copied file: -> the file is Test ccperl --- End of the process at: 18:58 After, execute the project "test_log_build.bld" You should obtain: 18:59 1 fichier(s) copi‚(s). 18:59 18:59 --- Beginning of the process at: create the file... start the copy... start the reading at: content of the copied file: -> the file is Test ccperl --- End of the process at: Thanks for your help |
#8
|
|||
|
|||
It appears that ccperl.exe does something very non-standard (and possibly just plain wrong) when generating its output, because redirecting to a file from a Command Prompt (which I thought might be a good workaround):
ccperl test_log_build.prl >out.txt also results in the incorrect output ordering. If you can find a way to get that to work, then you could use %DOSCMD% ccperl test_log_build.prl >%TEMP%\out.txt in the Run Program step, configuring it to read output from that file instead of stdout. |
#9
|
|||
|
|||
You're right!
ccperl seems to manage the dos prompt differently for the 'print' statement ( The only way I found is to replace all my Print "my message"; by System("cmd /c echo my message"); Really strange??!! Anyway, thanks a lot for your support. |
|
|