Created
July 21, 2016 12:25
-
-
Save techtonik/b9523fc8ef841a1074afb75e2d9bfdf6 to your computer and use it in GitHub Desktop.
less through subprocess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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