Changeset 4574
- Timestamp:
- 07/09/09 12:51:05 (14 months ago)
- Author:
- jmoore
- Message:
-
ticket:1402 - check_java added to java.py
This should actually be taken care of by unifying all our
uses of subprocess into a single module which catches the
exception on subprocess.Popen() and displays the actual
command-line which was used.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r4090
|
r4574
|
|
| 9 | 9 | import platform |
| 10 | 10 | import subprocess |
| | 11 | import exceptions |
| | 12 | import logging |
| | 13 | |
| 11 | 14 | |
| 12 | 15 | DEFAULT_DEBUG = "-Xrunjdwp:server=y,transport=dt_socket,address=8787,suspend=n" |
| | 16 | |
| | 17 | def check_java(command): |
| | 18 | try: |
| | 19 | p = subprocess.Popen([command[0],"-version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| | 20 | std = p.communicate() |
| | 21 | rc = p.wait() |
| | 22 | if rc == 0: |
| | 23 | return |
| | 24 | except: |
| | 25 | pass # Falls through to raise |
| | 26 | |
| | 27 | raise exceptions.Exception("Java could not be found. (Executable=%s)" % command[0]) |
| 13 | 28 | |
| 14 | 29 | def makeVar(key, env): |
| … |
… |
|
| 81 | 96 | """ |
| 82 | 97 | command = cmd(args, java, xargs, chdir, debug, debug_string) |
| | 98 | check_java(command) |
| 83 | 99 | if use_exec: |
| 84 | 100 | env = os.environ |
| … |
… |
|
| 108 | 124 | """ |
| 109 | 125 | command = cmd(args, java, xargs, chdir, debug, debug_string) |
| | 126 | check_java(command) |
| 110 | 127 | if not chdir: |
| 111 | 128 | chdir = os.getcwd() |
Download in other formats:
1.2.1-PRO © 2008-2009
agile42 all
rights reserved
(this page was served in: 0.64623 sec.)