Version: (using KDE 4.3.3)
Compiler: gcc 4.3.4 AMD64
Installed from: Gentoo Packages
Steps to reproduce:
1. In System Settings, enable the "Session Finished With Non-Zero Status" notification popup for Konsole.
2. Open a BASH session in Konsole.
3. Cleanly close Konsole by issuing 'exit' to BASH.
No notification appears.
A notification popup appears: "program '/bin/bash' exited with status 0"
Created attachment 61984 [details]
trigger the notification only when terminal process finishes with non-zero exitcode
I can reproduce this with 2.7.999 and I'm pretty sure there is bug in the code.
The attached patch is a quick fix. Its main purpose is to point out the bug.
Some thoughts about Session::done(int exitStatus)
1). this slot is connected with signal QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus).
so the parameter name is misleading. It actually should be named as exitCode.
2). _wantedClose is the root cause. It is initialized to false and becomes true only when user close the session from menu . So if the terminal process finishes itself , '!_wantedClose || exitStatus != 0' is always ture, and the notification is trigged.
3). _wantedClose is not a name clear enough . Is _userWantedClose or better?
Git commit b8b3f23723690cc67d38add4209a34c15c21b990 by Kurt Hindenburg.
Committed on 20/07/2011 at 15:53.
Pushed by hindenburg into branch 'master'.
Correct non-zero status notification such that it works.
The non-zero notification was being displayed for zero exit codes.
Thanks again to Jekyll Wu (firstname.lastname@example.org) for patch and research.
M +3 -2 src/Session.h
M +8 -9 src/Session.cpp