[X2Go-Commits] [x2goclient] 06/09: Add cmd line option --terminate-on-ctrl-c.
git-admin at x2go.org
git-admin at x2go.org
Fri Dec 15 21:05:10 CET 2023
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to annotated tag 0.1.4.2
in repository x2goclient.
commit 1d7da12b3de5787b7ada39333601bccbe50f4c5c
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Wed Aug 17 02:27:57 2011 +0200
Add cmd line option --terminate-on-ctrl-c.
---
debian/changelog | 1 +
pyhoca-cli | 1 +
pyhoca/cli/frontend.py | 8 ++++++++
3 files changed, 10 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 981b6c5c..17142c22 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,7 @@ pyhoca-cli (0.1.4.2-0~x2go1) UNRELEASED; urgency=low
all sessions of the connecting user.
- Allow ,,NEWEST'' and ,,OLDEST'' as session name when resuming (closes
upstream issue #86).
+ - Add cmd line option --terminate-on-ctrl-c.
-- Mike Gabriel <mike.gabriel at das-netzwerkteam.de> Wed, 06 Jul 2011 22:18:01 +0200
diff --git a/pyhoca-cli b/pyhoca-cli
index 71f75916..741f9cdf 100755
--- a/pyhoca-cli
+++ b/pyhoca-cli
@@ -122,6 +122,7 @@ x2go_options = [
{'args':['--share-mode'], 'default': 0, 'help': 'share mode for X2go desktop sharing (0: view-only, 1: full access)', },
{'args':['-F', '--share-local-folders'], 'metavar': '<folder1>[,<folder2[,...]]', 'default': None, 'help': 'a comma separated list of local folder names to mount in the X2go session', },
{'args':['--clean-sessions'], 'default': False, 'action': 'store_true', 'help': 'clean all suspended sessions before starting a new one', },
+ {'args':['--terminate-on-ctrl-c'], 'default': False, 'action': 'store_true', 'help': 'terminate the connected session when pressing CTRL+C (instead of suspending the session)', },
{'args':['--time-to-wait'], 'default': '8', 'help': 'time to wait for session startup/resume (default: 8s)', },
]
print_options = [
diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py
index 82487d47..e5b36729 100644
--- a/pyhoca/cli/frontend.py
+++ b/pyhoca/cli/frontend.py
@@ -441,6 +441,8 @@ class PyHocaCLI(x2go.X2goClient):
self._pyhoca_logger("X2go session name is: %s" % session_name, loglevel=x2go.loglevel_INFO, )
if self.args.share_desktop:
self._pyhoca_logger("Press CTRL+C to end desktop sharing for this session...", loglevel=x2go.loglevel_NOTICE, )
+ elif self.args.terminate_on_ctrl_c:
+ self._pyhoca_logger("Press CTRL+C to terminate the running session...", loglevel=x2go.loglevel_NOTICE, )
else:
self._pyhoca_logger("Press CTRL+C to suspend the running session...", loglevel=x2go.loglevel_NOTICE, )
@@ -469,6 +471,12 @@ class PyHocaCLI(x2go.X2goClient):
self._X2goClient__terminate_session(self.x2go_session_hash)
time.sleep(2)
self._pyhoca_logger("X2go session %s has been terminated" % session_name, loglevel=x2go.loglevel_NOTICE, )
+ elif self.args.terminate_on_ctrl_c:
+ self._pyhoca_logger("Terminating X2go session %s" % session_name, loglevel=x2go.loglevel_INFO, )
+ self._X2goClient__terminate_session(self.x2go_session_hash)
+ # giving nxproxy's SSH tunnel some time to settle
+ time.sleep(2)
+ self._pyhoca_logger("X2go session %s has been terminated" % session_name, loglevel=x2go.loglevel_NOTICE, )
else:
self._pyhoca_logger("Suspending X2go session %s" % session_name, loglevel=x2go.loglevel_INFO, )
self._X2goClient__suspend_session(self.x2go_session_hash)
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list