Command Line does not return 0 when successful

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Philippe
Posts: 7
Joined: Tue Nov 21, 2017 5:38 pm

Command Line does not return 0 when successful

Unread post by Philippe »

Hi !

I'm working on automating the build of our online help and for such I am using the Help And Manual command line and Jenkins.

Now, I've tried this in different ways, in a DOS window and in a PowerShell Window, both in batch files (.bat) or powershell files (.ps1) and the same on Jenkins.

I'm using these tags /HTML=<file>/I=HTML,ALL /O=<file> /L=<file>

Everytime I execute this command, the ERRORLEVEL is raised above 0 (i.e. some error happened), so the build fails (on Jenkins, and also with these scripts I wrote evaluating the ERRORLEVEL / ExitCode) BUT the thing is that the Help and Manual compilation seems to have went fine, as no error message is output, not in the console, not in the log.

If this can help find the issue, I did notice that executing the batch file in the DOS prompt makes it end with "Compilation complete" and stays there (No matter how long I wait it seems I have to press enter to return to the command prompt). Whereas executing the powershell script returns ERRORLEVEL 1.

One also quite weird thing is that executing the *batch* file (.bat, not .ps1) in powershell window does seem to work without raising any error, but for some reason doing the same through Jenkins does detect the ERRORLEVEL (ARGH ! >.< )

I am wondering if there is a bug or if it is just me that's doing something wrong.

This is the command I use:
F:\Jenkins\Workspaces\Help_Rdm_Win_En>"C:\Program Files (x86)\EC Software\HelpAndManual7\HELPMAN.EXE" F:\Jenkins\Workspaces\Help_Rdm_Win_En\common\..\en\products\Rdm\Windows\Rdm_Windows_en.hmxp /HTML=F:\Jenkins\Workspaces\Help_Rdm_Win_En\common\Resources\index.html /I=HTML,ALL /O=F:\Jenkins\Workspaces\Help_Rdm_Win_En\common\..\en\skins\common\DevZoomCommon.hmSkin /L=C:\Users\david\AppData\Local\Temp\Rdm_Windows_en.log

And this is the output I get (in the console and log file):

#Help & Manual command line compiler version 7.2.0 build 4035
Compiling F:\Jenkins\Workspaces\Help_Rdm_Win_En\common\..\en\products\Rdm\Windows\Rdm_Windows_en.hmxp
[Info] Preparing topics
[Info] Preparing table of contents
[Info] Preparing project files
[Info] Preparing merged projects
[Info] Writing topics
[Info] Generating Webhelp
[Info] Compilation of F:\Jenkins\Workspaces\Help_Rdm_Win_En\en\products\Rdm\Windows\Rdm_Windows_en.hmxp started 2017-11-22 11:55:12 AM
[Compiler Results] Generating Full-text Search Index...
[Info] Compilation complete

Please help me out, I need to make this work with Jenkins. :) Thanks !
User avatar
Tim Green
Site Admin
Posts: 23143
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Command Line does not return 0 when successful

Unread post by Tim Green »

Hi Philippe,
#Help & Manual command line compiler version 7.2.0 build 4035
This probably isn't the cause, but before doing anything else, please update to the current version (7.3.2 Build 4260), because we can't do error-checking on outdated versions.

I don't have experience with standard batch files in PowerShell windows, but first try it in the normal command prompt. Do you still get an error level of 1 there? I'm going to ask our developers to look into it as well.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Tim Green
Site Admin
Posts: 23143
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Command Line does not return 0 when successful

Unread post by Tim Green »

Hi Philippe,

Another thing to check: Have you turned off build error messages in View > Program Options > Compilers? That will also turn them off in command line builds.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Philippe
Posts: 7
Joined: Tue Nov 21, 2017 5:38 pm

Re: Command Line does not return 0 when successful

Unread post by Philippe »

First of all, thank you for your very quick reply :)

I will try to upgrade, but I think it's a bad Idea to turn off build errors. I think I will code a wrapper instead.

Please let me know when you get an answer from the H&M dev team.

Thanks !
User avatar
Tim Green
Site Admin
Posts: 23143
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Command Line does not return 0 when successful

Unread post by Tim Green »

Philippe wrote:I will try to upgrade, but I think it's a bad Idea to turn off build errors.
I wasn't suggesting that you turn them off, but rather that they are probably already off so that you are not seeing the error that is probably genuinely occurring... 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Philippe
Posts: 7
Joined: Tue Nov 21, 2017 5:38 pm

Re: Command Line does not return 0 when successful

Unread post by Philippe »

Ah yes I see what you mean hehe :)

I just checked, the boxes are checked for warnings and errors, the settings should be fine.

Any news from the dev team ?
User avatar
Tim Green
Site Admin
Posts: 23143
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Command Line does not return 0 when successful

Unread post by Tim Green »

Philippe wrote:Any news from the dev team ?
They suggest you should try running it in a normal command line console instead of in Jenkins or PowerShell. Do you still get a non-zero exit code at the end?
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Philippe
Posts: 7
Joined: Tue Nov 21, 2017 5:38 pm

Re: Command Line does not return 0 when successful

Unread post by Philippe »

Yes, I had already tried that, same result. Also, for now we are forced to use the version we have now, so I can't upgrade. I went with the wrapper for now.
User avatar
Tim Green
Site Admin
Posts: 23143
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Command Line does not return 0 when successful

Unread post by Tim Green »

Hi Philippe,

If you're also getting this in the normal command console it would be helpful if you could send us a small demo project that reproduces the issue so that we can look into it. Pack everything in a zip and mail it to support AT ec-software.com (replace the AT with @) and we'll check it out. :)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Tim Frost
Posts: 319
Joined: Mon Nov 22, 2004 11:45 pm

Re: Command Line does not return 0 when successful

Unread post by Tim Frost »

I am seeing the same problem on the first build after upgrading to 7.3.3. I am building CHM, PDF, EXE and Webhelp from the same project, controlled by an INI file. No errors are reported in the log, and all the output looks good. However Finalbuilder reports that 'Program returned code 2'.

As a workaround I can tell Finalbuilder to ignore the error code, but this can only be temporary because I would need to pause the build and check the output manually each time.
Tim Frost
Posts: 319
Joined: Mon Nov 22, 2004 11:45 pm

Re: Command Line does not return 0 when successful

Unread post by Tim Frost »

On closer examination this does not appear to be quite the same. The log does contain a warning, not an error:

Code: Select all

...
[Warning] Subsequent thread pre-terminated
[Info] STATUS: Normal Thread Termination
[Info] Compilation complete
...
This comes immediately after running the Wrensoft Zoom "Custom for EC Software" edition, although the project is configured to use the Full Wrensoft engine. I will send the log and the INI file to support, and perhaps this subthread needs to be moved to a separate forum item!
User avatar
Tim Green
Site Admin
Posts: 23143
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Command Line does not return 0 when successful

Unread post by Tim Green »

Hi Tim,
[Warning] Subsequent thread pre-terminated
That looks as though it might be a debug message. I'm asking the dev team what gives there and I'll get back to you on it.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Tim Green
Site Admin
Posts: 23143
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Command Line does not return 0 when successful

Unread post by Tim Green »

Update: The "Subsequent thread pre-terminated" message was a message relating to generation of the search index that normally needs to be suppressed. The fact that it wasn't here was causing the non-zero exit codes. This has been corrected in Build 4342:

https://www.helpandmanual.com/downloads.html?upd
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
ContiChris
Posts: 8
Joined: Wed Dec 21, 2016 11:36 am

Re: Command Line does not return 0 when successful

Unread post by ContiChris »

Hi Tim,
I ran into the same problem.
I'm using Version 7.3.3 Build 4342. In the application I switched off all the Compiler Messages.
Jenkins ends with the message: "script returned exit code 2".
I ran the following batch command:

Code: Select all

helpman D:\jenkins\dust_help\myProject\myProject.hmxp /chm=D:\jenkins\myProject_help\output\chm\myProject_help.chm
If I run the same commend on my build server in the command-line-box, the execution just won't finish. After the execution I first have to press the enter key to come back to the command prompt.
The Output is like this:

Code: Select all

[Info] Preparing topics
[Info] Preparing table of contents
[Info] Preparing project files
[Info] Preparing merged projects
[Info] Writing topics
[Info] Compiling help file
[Info] Compilation complete
...but as mentioned after the last line the command prompt will not appear again. I have the same behavior with different output formats.

By accident I found out that it works when I put a pipe with an echo-command after the helpman-command. Since I'm not an expert in command line usage I don't know exactly what that means but for me it is a workaround for Jenkins for right now.
So my command will look like this:

Code: Select all

helpman D:\jenkins\dust_help\myProject\myProject.hmxp /chm=D:\jenkins\myProject_help\output\chm\myProject_help.chm | echo
PS: in all cases the output will be generated well
User avatar
Tim Green
Site Admin
Posts: 23143
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Command Line does not return 0 when successful

Unread post by Tim Green »

Hi Chris,
I'm using Version 7.3.3 Build 4342. In the application I switched off all the Compiler Messages.
Do you still get the same problem when you switch the messages all on? You should at least get some information about the warning or error then, if there is one...
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply