Compiler outputs the errors under Wine, but not on

2019-07-29 06:10发布

I've got .mqh source code file with syntax error, for example created by the following command:

echo some_error > fail.mqh

Now, I'm using Metaeditor compiler to check the syntax and my goal is to print the errors to the standard output (CON), instead of logging them to the file (/log:file.log). See: Compiling.

The following syntax works fine on Linux/macOS as follow (also under wine cmd.exe):

$ wine metaeditor.exe /s /log:CON /compile:fail.mqh
??fail.mqh : information: Checking 'fail.mqh'
fail.mqh(1,1) : error 116: 'some_error' - declaration without type
fail.mqh(1,1) : error 161: 'some_error' - unexpected end of program
 : information: Result 2 error(s), 0 warning(s)

Please note that the /log parameter is required, otherwise the compiler doesn't print anything by default. So if /log is specified, then by default it logs the compilation result to the file. And I'm using special CON device to display the errors.

The problem is when I'm running the same command on Windows (cmd), then I've got no output:

> metaeditor.exe /s /log:CON /compile:fail.mqh

Same for CON:/con: as well. Also on PowerShell.

Although CON works for echo, e.g.: echo test > CON.

I could assume it could be a bug of the compiler, but then it works fine under Wine. Why would this work only under Wine?

Is there another way of outputting the errors to the terminal screen on Windows, instead of log file?


Note: You can install compiler from the site or download the binary (32bit or 64bit) to test above.


Clarification: My main blocker for using two separate commands (compile and print the error log after that) is that CI test may fail before the errors are printed, which makes the tests useless and it's a story for another question. So my goal is to check the syntax and print the errors at one go.

1条回答
聊天终结者
2楼-- · 2019-07-29 06:42

According to Support Team, Metaeditor application does not have a console, so it cannot output logs to the screen. So it seems wine handles special CON device differently. I've reported the issue to the Service Desk and it's still open, so they may implement the console support in the future.

Currently the only workaround is to use type command for output log file to console after compiling the files (or emulate it under wine). Even if the compiler could display it to the console, it won't work properly with CI either (in terms of handling the error codes), because logic of return exit of metaeditor.exe is completely broken as it returns the number of successfully compiled files instead of the error code (e.g. if you compile 20 files, you'll get 20 error code?!)! So relying on return exit of metaeditor.exe is a mistake and MQL team isn't planning to fix it anyway, since they say this is how it should work in their opinion.

查看更多
登录 后发表回答