1234567891011121314151617181920212223242526272829 |
- #!/usr/bin/env python3
- """
- ranger/ext/rifle.py:
- > self.hook_before_executing(command, self._mimetype, self._app_flags)
- > try:
- > if 'r' in flags:
- > prefix = ['sudo', '-E', 'su', '-mc']
- > else:
- > prefix = ['/bin/sh', '-c']
- >
- > cmd = prefix + [command]
- > if 't' in flags:
- > # ...
- > cmd = [os.environ['TERMCMD'], '-e'] + cmd
- however termite expects the entire cmd as one single param
- """
- import pipes
- import subprocess
- import sys
- assert sys.argv[1] == '-e', sys.argv
- subprocess.call([
- 'termite',
- '--exec={}'.format(' '.join(pipes.quote(p) for p in sys.argv[2:])),
- ])
|