Problem 2159

Summary: G4UImanager::ApplyCommand returns 0 when executing non-existing macro file
Product: Geant4 Reporter: Nicola Mori <mori>
Component: intercomsAssignee: asai
Status: RESOLVED FIXED    
Severity: major CC: mori
Priority: P4    
Version: 10.4   
Hardware: PC   
OS: Linux   

Description Nicola Mori 2019-04-17 12:17:09 CEST
In my application I execute the command given in a macro file by means of:

  G4UImanager* UImanager = G4UImanager::GetUIpointer();
  auto result UImanager->ApplyCommand(std::string("/control/execute ") + fileName);
  std::cout << "result: " << result << std::endl;

According to the comment in G4UImanager.hh, the return value should be positive non-zero when an error occurs. However, it is 0 when fileName is the name of a non-existing file:

  ERROR: Can not open a macro file <nonExistingFile.mac>. Set macro path with "/control/macroPath" if needed.
  result: 0

Similarly, when the macro contains a bad command the return value is again 0:

  ***** COMMAND NOT FOUND </nonExistingCommand> *****
  
  ***** Batch is interrupted!! *****
  result: 0


So how can I check whether the execution of the macro has been successful or not?
Comment 1 asai 2019-04-17 19:30:26 CEST
Thank you for reporting this issue. We will fix it with the next patch release.
Kind regards,
Makoto Asai
Comment 2 asai 2019-04-17 22:21:29 CEST
The fix will be included in the next patch release (version 10.5-patch02). There is no immediate plan of porting it back to the previous versions as this fix requires a functionality introduced with 10.5.

Thank you for reporting this issue, once again.
Makoto
Comment 3 Nicola Mori 2019-04-18 14:02:42 CEST
Thank you Makoto for the quick fix. Is there an estimate about when the 10.5-patch02 version will be released?