Commit Graph

107 Commits

Author SHA1 Message Date
Kurt Hindenburg
ea6bbcb4fe For ptytest failures print errno; close pty after testing
Every now and then the PtyTest fails.  A rerun typically fixes it.
Add errno output on tcgetpgrp failure. Close pty after test.

FAIL!  : Konsole::PtyTest::testRunProgram() Compared values are not the same
   Actual   (pty.foregroundProcessGroup()): 0
   Expected (pty.processId())             : 3239
2023-03-12 23:55:34 +00:00
Waqar Ahmed
fd96db9369 Fix tab close 2023-03-09 11:16:35 +05:00
Waqar Ahmed
ab81bd4828 Fix incorrect size being used initially 2023-03-09 11:16:35 +05:00
Waqar Ahmed
39059d3cc3 Improve process finished handling 2023-03-09 11:16:35 +05:00
Waqar Ahmed
b72df2372a Add conpty backend for windows 2023-03-09 11:16:35 +05:00
Waqar Ahmed
efb1686e62 Make konsole compile on windows 2023-03-09 11:16:35 +05:00
Harald Sitter
273448af3e move shell argument manipulation to session
we need this to happen before KSandbox::makeHostContext because the
first argument is not necessarily the shell command anymore afterwards,
confusing the legacy logic inside Pty. simply move the manipulation into
Session.cpp

this should make the flatpak build work properly
2022-11-05 18:15:11 +01:00
Ahmad Samir
38d5fa529f Use delegating constructors in Pty
And move the code from init() to the constructor, and remove init(), not
needed any more.
2022-06-01 14:35:49 +00:00
Ahmad Samir
2117727305 Port to Qt6 QProcess::setChildProcessModifier() 2022-06-01 14:35:49 +00:00
Luis Javier Merino Morán
e16f5fb5b4 4-arg setWinSize() was added on 5.93, not 5.92
The setWinSize(int lines, int columns, int height, int width) which also
takes pixels was added on 3c99d9e5, which landed on 5.93.
2022-05-28 13:28:32 +02:00
Oswald Buddenhagen
c2c2f8a0f7 make the pty's pixel size actually follow the emulation's size
... rather than using a side channel to propagate the window size.

amends 7a27f4072.
2022-05-02 09:54:32 +00:00
Oswald Buddenhagen
38b92f3597 make use of new KPty::setWinSize() overload
also remove the redundant pty()->setWinSize() call in the fallback
case, as it does the same as the subsequent code.
2022-05-02 09:54:32 +00:00
Oswald Buddenhagen
f315950361 remove pretenses of windows support
kpty code is (as of now) unix-only, so konsole as a whole cannot
possibly work on windows (without a thick emulation layer). therefore,
remove the pointless #ifdefs that only reduce the code's legibility.
2022-05-02 09:54:32 +00:00
Matan Ziv-Av
7a27f40722 Use TIOCSWINSZ ioctl to set pty's pixel size, so it will be reported to apps using TIOCGWINSZE 2022-02-07 10:49:07 +00:00
Ahmad Samir
97569b764c Run clang-format on the whole repo
Also install the relevant git hook.

GIT_SILENT
2021-09-06 12:51:39 +02:00
Christoph Cullmann
3d967a5974 improve session closing behavior
the new session close behavior is again the old

- first send SIGHUP and wait one second if that works
- then hard kill

before we tried to send an EOF character
this needed workaround to not kill "non shell" programs
unexpected and doesn't work e.g. if

- you have some not finished command input in your shell
- on e.g. FreeBSD in general

When closing the session with some background process still running:
- using Ctrl+D (which sends EOF) will leave that background process running
  (which is the expected behaviour with e.g. BASH:
  https://lists.gnu.org/archive/html/bug-bash/2009-03/msg00091.html)
- using e.g. the close button on the titlebar will close the session and kill any background processes

You can also use 'somecommand & disown', if you want to ensure background processes
aren't killed when you close a konsole window.

BUG: 401898
CCBUG: 185140
2021-08-13 12:57:35 +00:00
Ahmad Samir
d06ea23903 Use Q_EMIT instead of emit
In C++20 there are new classes that have member functions named emit().
c.f.:
https://lists.qt-project.org/pipermail/development/2020-February/038812.html
https://en.cppreference.com/w/cpp/io/basic_osyncstream/emit

A similar change was done in the Frameworks:
https://invent.kde.org/frameworks/kio/-/merge_requests/315
2021-02-15 23:52:07 +00:00
Kurt Hindenburg
0f656a32ff Remove 'This file is part of' comment lines 2020-11-12 22:35:45 -05:00
Kurt Hindenburg
78a0092522 Convert src to use SPDX license/copyright
https://community.kde.org/Policies/Licensing_Policy#SPDX_Statements
https://community.kde.org/Guidelines_and_HOWTOs/Licensing
2020-11-12 22:17:06 -05:00
Kurt Hindenburg
9af85cd2ea Fix integer literal suffix 'u' is not upper-case 2020-07-15 23:53:09 -04:00
Kurt Hindenburg
ab0636de8a Q_UNUSED() does not need semi-colon at end 2020-03-28 14:06:25 -04:00
Ahmad Samir
5f60bc5a6f Replace foreach (deprecated) with range-for
The code compiles and konsole seems to work as bofore.
2019-12-03 11:29:31 +02:00
Kurt Hindenburg
afe5bb4300 For returns use a braced initializer list 2018-10-27 23:07:38 -04:00
Kurt Hindenburg
ec5c05751c modernize deprecated header 2018-10-27 22:46:50 -04:00
Kurt Hindenburg
0cc7fecdd7 Fix regression in pty()->write() usage
Correct usage of pty()->write(const QByteArray)

BUG: 355362
BUG: 382654
2017-07-24 09:50:00 -04:00
Kurt Hindenburg
2a2a56d73c modernize use nullptr 2017-07-15 23:28:32 -04:00
Kurt Hindenburg
eb9234ae98 uncrustify using kf5 config 2017-06-27 21:53:13 -04:00
Kurt Hindenburg
b4b4a502bf More changes to QLatin1String, QLatin1Char and QStringLiteral 2017-05-07 14:25:59 -04:00
Kurt Hindenburg
eade05a4bd Do not specify Qt modules in includes 2017-04-26 21:33:34 -04:00
Kurt Hindenburg
869c361602 constructors/decontructors use =default instead of {} 2017-04-01 14:01:41 -04:00
Kurt Hindenburg
dfafff97d4 remove QDebug/qWarning and use QCDebug 2017-03-31 21:06:18 -04:00
Kurt Hindenburg
66044df34b fix a lot of issues of readability-implicit-bool-cast 2017-03-29 08:32:59 -04:00
Kurt Hindenburg
068b2af454 use correct return value of write() and check for empty data 2017-03-27 09:39:00 -04:00
Kurt Hindenburg
7aef6a35f7 Check that pty()->masterFd() is valid in foregroundProcessGroup
Other masterFd() have checks and it might prevent certain crashes in
Session::isForegroundProcessActive().
2017-01-22 12:01:29 -05:00
Kurt Hindenburg
2671800b08 set default TERM=xterm-256color
Change TERM=xterm to xterm-256color

CCBUG: 371919
BUG: 212145
2016-11-24 11:29:11 -05:00
Martin T. H. Sandsmark
2f1c8cf397 Send EOF when closing first, before SIGHUP
According to the bash maintainer sending EOF is the appropriate way of
telling e. g. bash to quit:
    http://permalink.gmane.org/gmane.comp.shells.bash.bugs/12602

I wasn't able to get KPtyProcess to send that in a nice way (calling
setStandardInputFile(QProcess::nullDevice(), for example), so we fetch
the EOF character manually with tcgetattr and send that.

BUG: 185140
REVIEW: 128416
2016-07-11 12:57:54 +02:00
Kurt Hindenburg
fb2b4e3275 Port kde_file.h KDE::chmod to ::chmod 2015-02-08 10:25:55 -10:00
Kurt Hindenburg
959b7e3257 Port KDE_struct_stat to QT_STATBUF; KDE::stat to QT_STAT 2015-02-07 09:11:09 -10:00
Montel Laurent
8182ac8edc Port to QDebug 2014-10-17 09:09:20 +02:00
Alex Richardson
a3ce74d4eb Convert to Qt5 signal slot syntax
REVIEW: 117482
2014-04-30 19:16:54 +02:00
Kurt Hindenburg
f92a45da2f Check return values of ::stat()
(cherry picked from commit 42240a7c6d)
2014-04-16 21:40:05 -04:00
Kurt Hindenburg
8523bcf657 Check return value of KDE::chmod
(cherry picked from commit fbffd35c31)
2014-04-16 21:39:51 -04:00
Kurt Hindenburg
1ea501da62 remove include moc from .cpp files - removes build warnings 2013-10-22 20:07:23 -04:00
Kurt Hindenburg
2c686b7afe Minor warning fixes when running under FreeBSD 2013-02-23 10:00:25 -05:00
Jekyll Wu
1a26982427 "#ifdef(XYZ)" -> "#if defined(XYZ)"
Use one form consistently in all code
2012-11-20 11:42:12 +08:00
Jekyll Wu
0909c34405 Make code a little more consistent 2012-06-04 22:25:14 +08:00
Jekyll Wu
09fd58de95 Move the code for setting various Pty properties out of Pty:start()
It feels strange that those properties are set again in Pty::start()
after they (should) have already been set before Pty::start() is called
2012-06-04 22:07:47 +08:00
Jekyll Wu
045284c405 Swap the order of column(width) and line(height) in method signature
It is more natural to use column x line.

TODO: The current code is inconsistent with itself regarding this issue
2012-06-04 13:49:04 +08:00
Kurt Hindenburg
3ceb32461c Allow non-English for program names; useful w/ -e
The old code used Latin1() to check program names and also used
QFile::encodeName().

Thanks to Eugene Shalygin for report and research.

Example:
cp `which vi` ./编辑器
konsole -e ./编辑器
BUG: 297529
FIXED-IN: 2.8.3
2012-04-10 11:27:32 -04:00
Kurt Hindenburg
5b083640ce whitespace and style fixes
Use 'git diff -w --ignore-all-space' to see non-whitespace changes
2012-04-05 11:08:53 -04:00