Use stdin argument instead of input for subprocess; makes it python 3.2 compatible

This commit is contained in:
Andrew Gibiansky 2015-03-20 17:00:59 -07:00
parent a69fd10131
commit dadd074ffd
2 changed files with 6 additions and 2 deletions

1
.gitignore vendored
View File

@ -18,3 +18,4 @@ profile/profile.tar
cabal.sandbox.config
.tmp1
.tmp2
.tmp3

View File

@ -8,8 +8,11 @@ import subprocess
def hindent(contents):
output = subprocess.check_output(["hindent", "--style", "gibiansky"],
input=bytes(contents, 'utf-8'))
with open(".tmp3", "w") as f:
f.write(contents)
with open(".tmp3", "r") as f:
output = subprocess.check_output(["hindent", "--style", "gibiansky"],
stdin=f)
return output.decode('utf-8')