mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
prequeue: less wasteful stdout rerouting
This commit is contained in:
parent
120ba96649
commit
23268279f2
|
@ -279,7 +279,9 @@ def setup_processor():
|
|||
|
||||
def main():
|
||||
processor = setup_processor()
|
||||
processor.preprocess()
|
||||
output = processor.preprocess()
|
||||
processor.update_globals()
|
||||
return output
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
11
prequeue.py
11
prequeue.py
|
@ -13,17 +13,20 @@ import preprocessor
|
|||
def main():
|
||||
processor = preprocessor.setup_processor()
|
||||
|
||||
for source in sys.argv[1:]:
|
||||
dest = os.path.splitext(source)[0] + '.tx'
|
||||
|
||||
stdin = sys.stdin
|
||||
stdout = sys.stdout
|
||||
|
||||
for source in sys.argv[1:]:
|
||||
dest = os.path.splitext(source)[0] + '.tx'
|
||||
sys.stdin = open(source, 'r')
|
||||
sys.stdout = open(dest, 'w')
|
||||
|
||||
processor.preprocess()
|
||||
|
||||
processor.update_globals()
|
||||
|
||||
sys.stdin = stdin
|
||||
sys.stdout = stdout
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue