diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-04-12 11:30:27 -0400 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-04-12 11:30:27 -0400 |
| commit | 09bc409657606a37346d82ab1e4c44a165bd3541 (patch) | |
| tree | 72c569f69f37acafdc89fde4724bde7b373ef8f9 /common.py | |
| parent | 384e322f974534c1c734db144633e3c3e002b1f8 (diff) | |
Improved error handling in run_exps.py.
Diffstat (limited to 'common.py')
| -rw-r--r-- | common.py | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -26,15 +26,17 @@ def get_executable_hint(prog, hint, optional=False): | |||
| 26 | '''Search for @prog in system PATH. Print @hint if no binary is found. | 26 | '''Search for @prog in system PATH. Print @hint if no binary is found. |
| 27 | Die if not @optional.''' | 27 | Die if not @optional.''' |
| 28 | try: | 28 | try: |
| 29 | prog = get_executable(prog) | 29 | full_path = get_executable(prog) |
| 30 | except IOError: | 30 | except IOError: |
| 31 | if not optional: | 31 | if not optional: |
| 32 | sys.stderr.write(("Cannot find executable '%s' in PATH. This is " +\ | 32 | sys.stderr.write(("Cannot find executable '%s' in PATH. This is " +\ |
| 33 | "a part of '%s' which should be added to PATH.\n")\ | 33 | "a part of '%s' which should be added to PATH.\n")\ |
| 34 | % (prog, hint)) | 34 | % (prog, hint)) |
| 35 | sys.exit(1) | 35 | sys.exit(1) |
| 36 | else: | ||
| 37 | full_path = None | ||
| 36 | 38 | ||
| 37 | return prog | 39 | return full_path |
| 38 | 40 | ||
| 39 | def get_config_option(option): | 41 | def get_config_option(option): |
| 40 | '''Search for @option in installed kernel config (if present). | 42 | '''Search for @option in installed kernel config (if present). |
