File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -161,21 +161,11 @@ elif sys.platform.startswith('linux'):
161
161
# The original arc_summary called /sbin/modinfo/{spl,zfs} to get
162
162
# the version information. We switch to /sys/module/{spl,zfs}/version
163
163
# to make sure we get what is really loaded in the kernel
164
- command = ["cat" , "/sys/module/{0}/version" .format (request )]
165
- req = request .upper ()
166
-
167
- # The recommended way to do this is with subprocess.run(). However,
168
- # some installed versions of Python are < 3.5, so we offer them
169
- # the option of doing it the old way (for now)
170
- if 'run' in dir (subprocess ):
171
- info = subprocess .run (command , stdout = subprocess .PIPE ,
172
- universal_newlines = True )
173
- version = info .stdout .strip ()
174
- else :
175
- info = subprocess .check_output (command , universal_newlines = True )
176
- version = info .strip ()
177
-
178
- return version
164
+ try :
165
+ with open ("/sys/module/{}/version" .format (request )) as f :
166
+ return f .read ().strip ()
167
+ except :
168
+ return "(unknown)"
179
169
180
170
def get_descriptions (request ):
181
171
"""Get the descriptions of the Solaris Porting Layer (SPL) or the
You can’t perform that action at this time.
0 commit comments