Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

server: workaround for idiotic ArchLinux renaming of python to python2.

First try running under python2, then python if that doesn't exist.
  • Loading branch information...
commit 1ca8aa5b891d01181a5d6a814631f6cf2cd08603 1 parent a62975e
@apenwarr apenwarr authored
Showing with 10 additions and 3 deletions.
  1. +1 −1  main.py
  2. +9 −2 ssh.py
View
2  main.py
@@ -54,7 +54,7 @@ def parse_ipport(s):
H,auto-hosts scan for remote hostnames and update local /etc/hosts
N,auto-nets automatically determine subnets to route
dns capture local DNS requests and forward to the remote DNS server
-python= path to python interpreter on the remote server [python]
+python= path to python interpreter on the remote server
r,remote= ssh hostname (and optional username) of remote sshuttle server
x,exclude= exclude this subnet (can be used more than once)
v,verbose increase debug message verbosity
View
11 ssh.py
@@ -73,16 +73,23 @@ def connect(ssh_cmd, rhostport, python, stderr, options):
if not rhost:
- argv = [python, '-c', pyscript]
+ # ignore the --python argument when running locally; we already know
+ # which python version works.
+ argv = [sys.argv[1], '-c', pyscript]
else:
if ssh_cmd:
sshl = ssh_cmd.split(' ')
else:
sshl = ['ssh']
+ if python:
+ pycmd = "'%s' -c '%s'" % (python, pyscript)
+ else:
+ pycmd = ("P=python2; $P -V 2>/dev/null || P=python; "
+ "\"$P\" -c '%s'") % pyscript
argv = (sshl +
portl +
ipv6flag +
- [rhost, '--', "'%s' -c '%s'" % (python, pyscript)])
+ [rhost, '--', pycmd])
(s1,s2) = socket.socketpair()
def setup():
# runs in the child process
Please sign in to comment.
Something went wrong with that request. Please try again.