which(program) -> str Minor modification to just directly invoking ``which`` on the remote system which adds the current working directory to the end of ``$PATH``.
(self, program)
| 1028 | return python |
| 1029 | |
| 1030 | def which(self, program): |
| 1031 | """which(program) -> str |
| 1032 | |
| 1033 | Minor modification to just directly invoking ``which`` on the remote |
| 1034 | system which adds the current working directory to the end of ``$PATH``. |
| 1035 | """ |
| 1036 | # If name is a path, do not attempt to resolve it. |
| 1037 | if os.path.sep in program: |
| 1038 | return program |
| 1039 | |
| 1040 | program = packing._encode(program) |
| 1041 | |
| 1042 | result = self.system(b'export PATH=$PATH:$PWD; command -v ' + program).recvall().strip() |
| 1043 | |
| 1044 | if (b'/' + program) not in result: |
| 1045 | return None |
| 1046 | |
| 1047 | return packing._decode(result) |
| 1048 | |
| 1049 | def system(self, process, tty = True, cwd = None, env = None, timeout = None, raw = True, wd = None): |
| 1050 | r"""system(process, tty = True, cwd = None, env = None, timeout = Timeout.default, raw = True) -> ssh_channel |