@@ -1141,8 +1141,8 @@ def which(self, program):
11411141
11421142 return result
11431143
1144- def system (self , process , tty = True , wd = None , env = None , timeout = None , raw = True ):
1145- r"""system(process, tty = True, wd = None, env = None, timeout = Timeout.default, raw = True) -> ssh_channel
1144+ def system (self , process , tty = True , cwd = None , env = None , timeout = None , raw = True , wd = None ):
1145+ r"""system(process, tty = True, cwd = None, env = None, timeout = Timeout.default, raw = True) -> ssh_channel
11461146
11471147 Open a new channel with a specific process inside. If `tty` is True,
11481148 then a TTY is requested on the remote server.
@@ -1162,20 +1162,23 @@ def system(self, process, tty = True, wd = None, env = None, timeout = None, raw
11621162 b'4\n'
11631163 >>> s.system('env | grep -a AAAA', env={'AAAA': b'\x90'}).recvall()
11641164 b'AAAA=\x90\n'
1165- >>> io = s.system('pwd', wd ='/tmp')
1165+ >>> io = s.system('pwd', cwd ='/tmp')
11661166 >>> io.recvall()
11671167 b'/tmp\n'
11681168 >>> io.cwd
11691169 '/tmp'
11701170 """
1171-
1172- if wd is None :
1173- wd = self .cwd
1171+ if wd is not None :
1172+ self .warning_once ("The 'wd' argument to ssh.system() is deprecated. Use 'cwd' instead." )
1173+ if cwd is None :
1174+ cwd = wd
1175+ if cwd is None :
1176+ cwd = self .cwd
11741177
11751178 if timeout is None :
11761179 timeout = self .timeout
11771180
1178- return ssh_channel (self , process , tty , wd , env , timeout = timeout , level = self .level , raw = raw )
1181+ return ssh_channel (self , process , tty , cwd , env , timeout = timeout , level = self .level , raw = raw )
11791182
11801183 #: Backward compatibility. Use :meth:`system`
11811184 run = system
@@ -1211,8 +1214,8 @@ def getenv(self, variable, **kwargs):
12111214
12121215
12131216
1214- def run_to_end (self , process , tty = False , wd = None , env = None ):
1215- r"""run_to_end(process, tty = False, timeout = Timeout.default , env = None) -> str
1217+ def run_to_end (self , process , tty = False , cwd = None , env = None , wd = None ):
1218+ r"""run_to_end(process, tty = False, cwd = None , env = None, timeout = Timeout.default ) -> str
12161219
12171220 Run a command on the remote server and return a tuple with
12181221 (data, exit_status). If `tty` is True, then the command is run inside
@@ -1224,8 +1227,13 @@ def run_to_end(self, process, tty = False, wd = None, env = None):
12241227 (b'Hello\n', 17)
12251228 """
12261229
1230+ if wd is not None :
1231+ self .warning_once ("The 'wd' argument to ssh.run_to_end() is deprecated. Use 'cwd' instead." )
1232+ if cwd is None :
1233+ cwd = wd
1234+
12271235 with context .local (log_level = 'ERROR' ):
1228- c = self .run (process , tty , wd = wd , timeout = Timeout .default )
1236+ c = self .run (process , tty , cwd = cwd , env = env , timeout = Timeout .default )
12291237 data = c .recvall ()
12301238 retcode = c .wait ()
12311239 c .close ()
@@ -1874,7 +1882,7 @@ def set_working_directory(self, wd = None, symlink = False):
18741882 wd = packing ._need_bytes (wd , 2 , 0x80 )
18751883
18761884 if not wd :
1877- wd , status = self .run_to_end ('x=$(mktemp -d) && cd $x && chmod +x . && echo $PWD' , wd = '.' )
1885+ wd , status = self .run_to_end ('x=$(mktemp -d) && cd $x && chmod +x . && echo $PWD' , cwd = '.' )
18781886 wd = wd .strip ()
18791887
18801888 if status :
0 commit comments