Bug 504860 - KDiff3 when launched from CLI detaches from the terminal
Summary: KDiff3 when launched from CLI detaches from the terminal
Status: RESOLVED UPSTREAM
Alias: None
Product: kdiff3
Classification: Applications
Component: application (other bugs)
Version First Reported In: 1.12.3
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: michael
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-27 13:15 UTC by Lapo Luchini
Modified: 2025-06-03 22:53 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lapo Luchini 2025-05-27 13:15:38 UTC
SUMMARY

It seems that current Windows version of KDiff3 when launched from CLI with parameters detaches from the terminal, which returns directly to the prompt while kdiff3 is still open. This breaks usage as a diff tool in scripts.

STEPS TO REPRODUCE
C:\> kdiff3 file1 file2 -o file3

OBSERVED RESULT
Immediate return to C:\> prompt.

EXPECTED RESULT
Return to prompt only when merge is finished and the application closed.

SOFTWARE/OS VERSIONS
KDiff3: 1.12.3 (64 bit)
KDE Frameworks: 6.14.0
Qt: Using 6.8.3 and built against 6.8.3
Windows 11 Version 24H2
Build ABI: x86_64-little_endian-llp64
Kernel: winnt 10.0.26200
Comment 1 michael 2025-05-27 16:49:53 UTC
This looks to be default behavior of the windows terminal. Rather annoying if your used to linux which does not default to this behavior. I'll have look but a suspect kdiff3 can't influence this. That said power shell has "Wait-Process" which will hold the script up until a process is finished.
Comment 2 michael 2025-06-02 00:59:23 UTC
As expected this decision is made at the termial/OS level before passing control to kdiff3 or the Qt framework.

Microsoft provides the start command for the use case you indicate where the termial must wait for kdiff3 to exit. The fallowing is example syntax  for launching kdiff3  with a two way compasrison but having the terminal wait on it.

Traditional command shell:

start -Wait 'C:\Program Files\KDiff3\bin\kdiff3.exe' C:\CraftRoot\tmp\manifest.json C:\CraftRoot\tmp\manifest-20250503T163525.json

PowerShell:
start -Wait 'C:\Program Files\KDiff3\bin\kdiff3.exe' -ArgumentList [C:\CraftRoot\tmp\manifest.json, C:\CraftRoot\tmp\manifest-20250503T163525.json]


PowerShell may be default in windows 11 but the traditional terminal can also be launched.
Comment 3 Lapo Luchini 2025-06-03 22:53:15 UTC
Thanks for checking and suggestions!
I was indeed mixing up behavior on FreeBSD and Linux in my head with Windows.