Recent

Author Topic: [Solved] Process exited with exit-code 0 - why?  (Read 253 times)

d7_2_laz

  • Hero Member
  • *****
  • Posts: 649
[Solved] Process exited with exit-code 0 - why?
« on: November 14, 2025, 03:15:48 pm »
Going from Laz 4.2 to 4.4 (Win 10 x64, using standard lazarus-4.4-fpc-3.2.2-win64.exe), standard install, i tested a couple of my programs: very fine, no regressions, no new probs, exe size fine --- perfect.  :)

Unexpectedly at the last prog i noticed that "Run" didn't start it.
- Compile and link project:  Target <path>\<exe-name>  Success
But it didn't start (via Run). -> Default or release mode, no difference.
- Event log: Process exited with exit-code 0.
- (For test:) Simply using "Run without Debugging" -> nothing happens

Clicking onto the generated exe via Explorer it works fine, just as expected ...
??? Why it hadn't been started?

As i know this exit-code 0 is the standard message when the generated executable is already ruuning:
No, it's not .. Is it in the Window's task-list? No. Maybe somehow an orphaned process though? So reboot. No success.

I went back to 4.2 (= reactivate the old backup folder plus the 4.2 config files within ...Users ... Appdata\Local).
Same.
%)  I cannot remember at all i once encountered this with that prog.
But, hm ... i rarely recompile this special app (actually no changes needed), only once per release as compatibility check.

Anyhow, i suspect it might something be strange within the project options.
Compared with the project options of the other apps -> cannot see a relevant difference.

What might be a possible reason for this exit-code 0 (only for one prog) ?
« Last Edit: November 14, 2025, 05:14:36 pm by d7_2_laz »
Lazarus 4.4  FPC 3.2.2 Win10 64bit

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11922
  • Debugger - SynEdit - and more
    • wiki
Re: (Suspect user-error:) Process exited with exit-code 0 - why?
« Reply #1 on: November 14, 2025, 03:57:07 pm »
Have you tried starting with F8? That should pause as soon as the "begin" in the main "program" is reached. Of course assuming that the exit does not happen before that.

Or you can set a breakpoint there.

Or try with gdb, maybe it gives more feedback?

d7_2_laz

  • Hero Member
  • *****
  • Posts: 649
Re: (Suspect user-error:) Process exited with exit-code 0 - why?
« Reply #2 on: November 14, 2025, 05:14:08 pm »
Hm, i'd assumed it isn't related to the debugger itself (as it occurs in Release mode, or using "Run without Debugging", as well).
GDB's event log tells: Process Start: <name>  .. Process Start: <name>  .. Process Exit normally.

Anyhow: the F8 (Step over) (still trying with GDB) helped me to come closer to the culprit, and this is (as i hoped) in front of the screen.

Within the .dpr file (from an earlier Delphi conversion) there are some conditions.
And this one actually does fail:
Code: Pascal  [Select][+][-]
  1.   bIDERuns := (FindWindowByCaptionParts('Lazarus-IDE', False) <> 0);     // Ouch!!!!
Should be now (the Lazarus IDE tag within the caption had changed meanwhile):
Code: Pascal  [Select][+][-]
  1.   bIDERuns := (FindWindowByCaptionParts('Lazarus IDE', False) <> 0);

I remember roughly i've had a similar thing a couple of years ago and we had spoken about this one too.
Thank you for your input Martin, it guided me in the right direction!
Lazarus 4.4  FPC 3.2.2 Win10 64bit

 

TinyPortal © 2005-2018