Converted to python3
Squashed commit of the following: commit 621e91d31ac04c7a692fb87a5cdf9235489e75b9 Author: Sven Velt <sven@velt.de> Date: Wed Nov 27 22:31:44 2019 +0100 Decode byte strings to UTF-8 commit 92c878cc8f14d66f54b1ed9d4587f41902e4c537 Author: Sven Velt <sven@velt.de> Date: Wed Nov 27 16:02:54 2019 +0100 2to3, interpreter changed Es werden aber binäre Strings ausgegeben :-/
This commit is contained in:
parent
62e46ef47e
commit
f8934c59f9
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -33,7 +33,7 @@ allowed = [
|
||||||
|
|
||||||
cmdline = os.getenv('SSH_ORIGINAL_COMMAND')
|
cmdline = os.getenv('SSH_ORIGINAL_COMMAND')
|
||||||
if not cmdline:
|
if not cmdline:
|
||||||
print 'This is just a wrapper, no command specified!'
|
print('This is just a wrapper, no command specified!')
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
for maybe in allowed:
|
for maybe in allowed:
|
||||||
|
@ -42,13 +42,13 @@ for maybe in allowed:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
|
cmd = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
|
||||||
except Exception, exc:
|
except Exception as exc:
|
||||||
print 'Could not execute plugin ("%s"): %s' % (' '.join(cmdline), exc)
|
print('Could not execute plugin ("%s"): %s' % (' '.join(cmdline), exc))
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
else:
|
else:
|
||||||
print cmd.communicate()[0].rstrip()
|
print(cmd.communicate()[0].rstrip().decode('utf-8'))
|
||||||
sys.exit(cmd.returncode)
|
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)
|
sys.exit(3)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue