Skip to content

Commit

Permalink
Allow load-and-go operation under Cygwin.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpressey committed Mar 28, 2012
1 parent aad57ca commit ad39e57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/8ebed2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"""

import logging
import os
import sys

from optparse import OptionParser
Expand Down
9 changes: 7 additions & 2 deletions src/eightebed/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def parse_and_gen(options, infilename, outfilename, tests=None):


def compile_and_run(filename, options):
# a bit of a hack
a_out = './a.out'
if sys.platform == 'cygwin':
a_out = './a.exe'

logger.info("Compiling...")
output = Popen([options.compiler, filename], stdout=PIPE).communicate()[0]
if options.verbose:
Expand All @@ -55,10 +60,10 @@ def compile_and_run(filename, options):
raise RuntimeError("Compilation failed!")
if options.run:
logger.info("Running...")
output = Popen(["./a.out"], stdout=PIPE).communicate()[0]
output = Popen([a_out], stdout=PIPE).communicate()[0]
if options.clean:
os.remove(filename)
os.remove("./a.out")
os.remove(a_out)
return output


Expand Down

0 comments on commit ad39e57

Please sign in to comment.