Capturing tools/compiler output

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
Guest

Capturing tools/compiler output

Post by Guest » Fri Dec 31, 2004 1:30 am

Hi,

is it possible to capture the standard output while running tools/compilers in such a way that the output is displayed in the window of the running tool as well as captured for summary in Zeus?

At the moment I'm testing Zeus with some python scripts I use to compile my sources and assets (Python creates some kind of ANT and other build scripts and executes additional tools for the final build) which for some projects takes quite some time and creates a lot of informational output while running. Now I'd like to see the build running (if only just to see everything's still ok) but after the build I'd like to have the output in Zeus in case there were compiletime errors and the like.

I hope thats doable because I really start to like Zeus but that's a feature I cannot live without :-(

Best regards,
Michael

jussij
Site Admin
Posts: 2449
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Fri Dec 31, 2004 2:57 am

Hi Michael,
is it possible to capture the standard output while running tools/compilers in such a way that the output is displayed in the window of the running tool as well as captured for summary in Zeus?
I think using something like tee will enable you to achive this result. For example assume we have a test.cmd batch file to simulate a script requiring user input:

Code: Select all

@echo off
dir *.*
pause 
The batch file displays the current directory and then asks the user to hit any key to continue.

Now using this Zeus macro:

Code: Select all

function key_macro()
   -- the batch command line which uses tee to capture the output to a file
   local cmd = "test.cmd | tee output.txt"

   -- run the command using a DOS window and wait for it to finish
   local flags = 16+32+64

   -- batch file is assumed to be c:\temp\test.cmd
   local dir = "c:\\temp"

   -- run command which should display a DOS window
   system(cmd, dir, flags)

   -- when the command ends send the output file to zeus
   flags = 2+16+32
   system("type output.txt", dir, flags)
end

key_macro() -- run the macro
it is possible to run the batch file in a DOS window and wait for the user input and then capture the output produced into a Zeus tool window.

Cheers Jussi
Last edited by jussij on Sun Jan 31, 2010 11:25 pm, edited 2 times in total.

Michael

Post by Michael » Fri Jan 14, 2005 12:32 pm

Hi Jussi,

is it possible to move the cursor (and the view) to the last (or any other) line if it is the output window, e.g. the one the logfile is written to, using system( "type"... )?
Seems like putting a set_line_pos after the system call doesn't work.

Best regards,
Michael

jussij
Site Admin
Posts: 2449
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Fri Jan 14, 2005 1:47 pm

Hi Michael,

I would have thought this should be possible, but I tried making several changes to the macro and none managed to achieve the desired result :(

I will need to take a closer look to find out why this is not working.

Cheers Jussi

jussij
Site Admin
Posts: 2449
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Fri Jan 14, 2005 3:20 pm

Hi Michael,

Unfortunately this appears to a timing, messaging or design related bug :(

The system macro function will start the program running and then create a background thread to monitor the program output. It then waits for the program to end. When the program ends the system macro function returns to the script with the process exit code.

But even though the program has ended the thread has not. The thread still has to manage the captured output and create the tool output window. So it is only some time later that the thread finish and the tool window appears.

To make things worse, I think windows is blocking the thread because any number of calls to the yield macro function will not see the thread end and the tool window appear. I think the tool window only appears after the script has ended at whcih time Windows unblocks the waiting thread :(

Cheers Jussi

jussij
Site Admin
Posts: 2449
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Thu Feb 03, 2005 8:33 am

Hi Michael,

The Zeus for Windows Version 3.94 release adds these new macro functions:

Code: Select all

int file_open_compiler(file name [,caption] [,source file])
int file_open_tool(file name [,caption])
int file_open_project(file name [,caption])
This enables the macro to be re-writting as follows:

Code: Select all

function key_macro()
   -- the batch command line which uses tee to capture the output to a file
   local cmd = "test.cmd | tee output.txt"

   -- run the command using a DOS window and wait for it to finish
   local flags = 16+32+64

   -- batch file is assumed to be c:\temp\test.cmd
   local dir = "c:\\temp"

   -- run command which should display a DOS window
   system(cmd, dir, flags)

   -- send the output to a Zeus compiler window
   file_open_compiler("c:\\temp\\output.txt","My Compiler")
end

key_macro() -- run the macro
and thus circumvents the timing error :)

Cheers Jussi

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: JeremyLaupe and 3 guests