Skip to content

Instantly share code, notes, and snippets.

@techtonik
Created July 21, 2016 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techtonik/b9523fc8ef841a1074afb75e2d9bfdf6 to your computer and use it in GitHub Desktop.
Save techtonik/b9523fc8ef841a1074afb75e2d9bfdf6 to your computer and use it in GitHub Desktop.
less through subprocess
# prepare pager
less = 'less'
if IS_WIN:
with open(ROOT + '\\git.bat') as r:
for line in r:
start = line.find('%~dp0')
if start != -1:
GIT_DIR = line[start+5:line.find('\cmd')]
less = ROOT + '\\' + GIT_DIR + '\\usr\\bin\\less'
break
less_proc = subprocess2.Popen([less, '-R'], stdin=subprocess2.PIPE)
# wait for less to exit
less_proc.stdin.close()
less_proc.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment