from __future__ import absolute_import, print_function
import sys, os, re, subprocess
-from bup import helpers, path
+from bup import path
from bup.compat import environ
def connect(rhost, port, subcmd, stderr=None):
if rhost is None or rhost == b'-':
argv = [path.exe(), subcmd]
else:
- buglvl = helpers.atoi(environ.get(b'BUP_DEBUG'))
- force_tty = helpers.atoi(environ.get(b'BUP_FORCE_TTY'))
- tty_width = helpers.atoi(environ.get(b'BUP_TTY_WIDTH'))
+ buglvl = int(environ.get(b'BUP_DEBUG', 0))
+ force_tty = int(environ.get(b'BUP_FORCE_TTY', 0))
+ tty_width = environ.get(b'BUP_TTY_WIDTH', None)
+ if tty_width is not None:
+ tty_width = b'BUP_TTY_WIDTH=%d' % int(tty_width)
+ else:
+ tty_width = b''
cmd = b"""
- sh -c 'BUP_DEBUG=%d BUP_FORCE_TTY=%d BUP_TTY_WIDTH=%d bup %s'
+ sh -c 'BUP_DEBUG=%d BUP_FORCE_TTY=%d %s bup %s'
""" % (buglvl, force_tty, tty_width, subcmd)
argv = [b'ssh']
if port: