Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
Adding internal flag for enabling remote debugging. Separated the log…
Browse files Browse the repository at this point in the history
…file errors and the stdout errors for users that pipe logfiles to stdout.
  • Loading branch information
timf committed Jan 30, 2011
1 parent 2be21da commit a7931c8
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/python/epumgmt/main/em_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@
import sys
import traceback

import em_core
import em_deprecated
import em_optparse
from epumgmt.api.exceptions import *
from epumgmt.api import *

remote_pycharm_debug = 0
try:
if remote_pycharm_debug:
from pydev import pydevd
except ImportError, e:
print >>sys.stderr, "Could not import remote debugging library: %s" % str(e)
remote_pycharm_debug = 0

def main(argv=None):
if os.name != 'posix':
print >>sys.stderr, "Only runs on POSIX systems."
return 3

if remote_pycharm_debug:
pydevd.settrace('localhost', port=51234, stdoutToServer=True, stderrToServer=True)

parser = em_optparse.parsersetup()

Expand All @@ -32,22 +42,22 @@ def main(argv=None):
epumgmt_run(epu, dbgmsgs=dbgmsgs)

except InvalidInput, e:
msg = "Problem with input: %s" % e.msg
msg = "\nProblem with input: %s" % e.msg
print >>sys.stderr, msg
return 1

except InvalidConfig, e:
msg = "Problem with configuration: %s" % e.msg
msg = "\nProblem with configuration: %s" % e.msg
print >>sys.stderr, msg
return 2

except IncompatibleEnvironment, e:
msg = "Problem with environment: %s" % e.msg
msg = "\nProblem with environment: %s" % e.msg
print >>sys.stderr, msg
return 3

except UnexpectedError, e:
msg = "Problem executing: %s" % e.msg
msg = "\nProblem executing: %s" % e.msg
print >>sys.stderr, msg
return 4

Expand Down

0 comments on commit a7931c8

Please sign in to comment.