From f8934c59f9c174a1940e66c9c4db15063ab0b823 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Sat, 22 Feb 2020 13:30:29 +0100 Subject: [PATCH] Converted to python3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squashed commit of the following: commit 621e91d31ac04c7a692fb87a5cdf9235489e75b9 Author: Sven Velt Date: Wed Nov 27 22:31:44 2019 +0100 Decode byte strings to UTF-8 commit 92c878cc8f14d66f54b1ed9d4587f41902e4c537 Author: Sven Velt Date: Wed Nov 27 16:02:54 2019 +0100 2to3, interpreter changed Es werden aber binäre Strings ausgegeben :-/ --- ssh-wrapper.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ssh-wrapper.py b/ssh-wrapper.py index 6de02c4..b69cc2c 100755 --- a/ssh-wrapper.py +++ b/ssh-wrapper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import re @@ -33,7 +33,7 @@ allowed = [ cmdline = os.getenv('SSH_ORIGINAL_COMMAND') if not cmdline: - print 'This is just a wrapper, no command specified!' + print('This is just a wrapper, no command specified!') sys.exit(3) for maybe in allowed: @@ -42,13 +42,13 @@ for maybe in allowed: try: cmd = subprocess.Popen(cmdline, stdout=subprocess.PIPE) - except Exception, exc: - print 'Could not execute plugin ("%s"): %s' % (' '.join(cmdline), exc) + except Exception as exc: + print('Could not execute plugin ("%s"): %s' % (' '.join(cmdline), exc)) sys.exit(3) else: - print cmd.communicate()[0].rstrip() + print(cmd.communicate()[0].rstrip().decode('utf-8')) sys.exit(cmd.returncode) -print '%s: No allowed command found!' % sys.argv[0] +print('%s: No allowed command found!' % sys.argv[0]) sys.exit(3)