From 31065ffe4a0d41663f9d94709a45af353f53d6e7 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 14 Mar 2018 19:02:34 +0545 Subject: [PATCH] issue #143: avoid long-form options in sudo.py. --- mitogen/sudo.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mitogen/sudo.py b/mitogen/sudo.py index 701a23ca..78aa3063 100644 --- a/mitogen/sudo.py +++ b/mitogen/sudo.py @@ -132,11 +132,14 @@ class Stream(mitogen.parent.Stream): self.name = 'sudo.' + self.username def get_boot_command(self): + # Note: sudo did not introduce long-format option processing until July + # 2013, so even though we parse long-format options, we always supply + # short-form to the sudo command. bits = [self.sudo_path, '-u', self.username] if self.preserve_env: - bits += ['--preserve-env'] + bits += ['-E'] if self.set_home: - bits += ['--set-home'] + bits += ['-H'] bits = bits + super(Stream, self).get_boot_command() LOG.debug('sudo command line: %r', bits) return bits