Kinook Software Forums

Kinook Software Forums (http://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (http://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Output - Wrong order of returned lines using 'Run Program' to launch Perl scripts (http://www.kinook.com/Forum/showthread.php?t=341)

VBPbetaTest 03-01-2004 06:53 AM

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)

kinook 03-02-2004 10:49 AM

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.

VBPbetaTest 03-02-2004 10:55 AM

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

kinook 03-02-2004 11:10 AM

What happens if you use a Run Program command of

%DOSCMD% ccperl.exe myscript.prl

VBPbetaTest 03-02-2004 11:27 AM

1 Attachment(s)
Unfortunately, the result is still upside down.

I join you the log.

Anyway, thanks a lot for your support.

kinook 03-02-2004 11:57 AM

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?

VBPbetaTest 03-02-2004 01:04 PM

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

kinook 03-02-2004 02:07 PM

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.

VBPbetaTest 03-09-2004 10:29 AM

You're right!
ccperl seems to manage the dos prompt differently for the 'print' statement :o(

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.


All times are GMT -5. The time now is 10:02 PM.


Copyright © 1999-2019 Kinook Software, Inc.