Skip to content

Commit

Permalink
Fix for eclim flashing command windows in Windows
Browse files Browse the repository at this point in the history
 * Added EclimExecutionException (rather than Dude.)
  • Loading branch information
CrypticTemple committed Jun 24, 2012
1 parent d21b67d commit f74ce01
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions eclim.py
Expand Up @@ -17,11 +17,12 @@

log = subclim_logging.getLogger('subclim')

class EclimExecutionException(Exception):
pass

class NotInEclipseProjectException(Exception):
pass


def call_eclim(cmdline):
''' Generic call to eclim including error-handling '''
def arg_string(s):
Expand All @@ -41,9 +42,18 @@ def arg_seq(args):
cmd = arg_seq(cmdline)
shell = False
else:
raise Exception('dude.' + str(cmd) + str(type(cmd)))
raise EclimExecutionException('Unknown command line passed. ' + repr(cmd) + ' ' + (type(cmd)))
log.info('Run: %s', cmd)
popen = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell)

# running with shell=False spawns new command windows for
# each execution of eclim_executable
sinfo = None
if os.name == 'nt' and not shell:
sinfo = subprocess.STARTUPINFO()
sinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
sinfo.wShowWindow = subprocess.SW_HIDE

popen = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell, startupinfo=sinfo)
out, err = popen.communicate()
log.debug("Results:\n" + out)

Expand All @@ -57,10 +67,9 @@ def arg_seq(args):
if "Connection refused" in out:
error_msg += " Is Eclipse running?"
log.error(error_msg)
raise Exception(error_msg)
raise EclimExecutionException(error_msg)
return out


def get_context(filename):
project_path = find_project_dir(filename)
if not project_path:
Expand Down

0 comments on commit f74ce01

Please sign in to comment.