Lemmings Forums
Lix => Lix Main => Topic started by: Forestidia86 on January 07, 2018, 07:33:20 PM
-
I don't know if this is the right place to ask this and it is I think Win specific:
But I don't want to use command prompt for building, so I do it via batch file. The problem is that it is then hard to catch error messages since the window closes usually immediately.
So I'd actually like to create a logfile. I know that you can generally use > to get the output to a file. But now my problem: While it catches some messages like concerning the libraries it doesn't seem to catch the actual compiling messages, in particular not compiling errors.
I don't know why and what I can do about it. Has anyone an idea?
Edit: Okay, I think I have found it out myself. For the compiling messages I seem to need to use 2>.
-
Redirecting errors is one good solution, yeah. Programs have standard output and a separate error stream.
Alternatively, you should be able to right-click the batch file, properties (Eigenschaften), then find a checkbox to keep the console open after the program has finished running.
Another alternative is to add "pause" without quotes to the end of the batch file. For a debugging build:
dub build
pause
For a release build that runs faster, but doesn't produce nice error messages when something fails during runtime:
dub build -b release
pause
-- Simon
-
Generically speaking, the compiler etc. might also have command line options as well to output errors and/or warnings to files, either in lieu of or in addition to outputting to console, but redirecting stderr as you did seems to work okay in a pinch. Adding the pause at the end can be useful just to see whether the final output reports success or failure before digging into logs.
-
After reading mobius' problems with copying the output from the cmd prompt:
That's one of the reasons why I want to use logfiles for building because I can copy the output (esp. error messages) conveniently from the text files.
Copying from cmd prompt seems convoluted and unintuitive for a Win user. (I know one method is: right click -> choose mark -> mark with mouse movement+ hold left click or with arrow keys+ hold Shift -> press Enter => now the marked text should be in copy buffer and can be pasted.)
-
Wow, I didn't know the Windows console is that unusable. Good to keep in mind, and important for remote troubleshooting.
You could install bash for Windows or Powershell, but I don't want to recommend anything over cmd. Once somebody benefits from any of those, they could decide themselves what they want.
-- Simon