• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.server
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 4574

Show
Ignore:
Timestamp:
07/09/09 12:51:05 (7 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:
1 modified

  • trunk/components/tools/OmeroPy/src/omero/java.py (modified) (3 diffs)

Legend:

Unmodified
Added
Removed
  • trunk/components/tools/OmeroPy/src/omero/java.py

    r4090 r4574  
    99import platform 
    1010import subprocess 
     11import exceptions 
     12import logging 
     13 
    1114 
    1215DEFAULT_DEBUG = "-Xrunjdwp:server=y,transport=dt_socket,address=8787,suspend=n" 
     16 
     17def 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]) 
    1328 
    1429def makeVar(key, env): 
    … …  
    8196    """ 
    8297    command = cmd(args, java, xargs, chdir, debug, debug_string) 
     98    check_java(command) 
    8399    if use_exec: 
    84100        env = os.environ 
    … …  
    108124    """ 
    109125    command = cmd(args, java, xargs, chdir, debug, debug_string) 
     126    check_java(command) 
    110127    if not chdir: 
    111128        chdir = os.getcwd() 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11.5
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/