File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 18
18
19
19
class JavaNotFoundException (Exception ):
20
20
def __str__ (self ):
21
- return 'Missing Java Runtime Environment on this system. ' + \
22
- 'The command "java" must be available.'
21
+ return ( 'Missing Java Runtime Environment on this system. ' +
22
+ 'The command "java" must be available.' )
23
23
24
24
25
25
class Validator (object ):
@@ -113,22 +113,21 @@ def all_files(self, skip_invisible=True):
113
113
def validate (self , files = None ):
114
114
if not files :
115
115
files = self .all_files ()
116
-
117
116
if sys .platform == 'cygwin' :
118
117
files = [self ._cygwin_path_convert (f ) for f in files ]
119
118
120
- with open (os .devnull , 'w' ) as f_null :
121
- if subprocess .call (['java' , '-version' ],
122
- stdout = f_null , stderr = f_null ) != 0 :
123
- raise JavaNotFoundException ()
124
-
125
119
try :
126
120
cmd = (['java' ] + self ._java_options +
127
121
['-jar' , self .vnu_jar_location ] + self ._vnu_options + files )
128
122
o = subprocess .check_output (
129
123
cmd ,
130
124
stderr = subprocess .STDOUT ,
131
125
).decode ('utf-8' )
126
+ except OSError as e :
127
+ if e .errno == os .errno .ENOENT :
128
+ raise JavaNotFoundException ()
129
+ else :
130
+ raise
132
131
except subprocess .CalledProcessError as e :
133
132
o = e .output .decode ('utf-8' )
134
133
You can’t perform that action at this time.
0 commit comments