66import inspect
77from owrx .config import Config
88import shlex
9+ import os
910
1011import logging
1112
@@ -102,12 +103,19 @@ def has_requirement(self, requirement):
102103 def get_requirement_description (self , requirement ):
103104 return inspect .getdoc (self ._get_requirement_method (requirement ))
104105
105- def command_is_runnable (self , command ):
106+ def command_is_runnable (self , command , expected_result = None ):
106107 tmp_dir = Config .get ()["temporary_directory" ]
107108 cmd = shlex .split (command )
109+ env = os .environ .copy ()
110+ # prevent X11 programs from opening windows if called from a GUI shell
111+ env .pop ("DISPLAY" , None )
108112 try :
109- process = subprocess .Popen (cmd , stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL , cwd = tmp_dir )
110- return process .wait () != 32512
113+ process = subprocess .Popen (cmd , stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL , cwd = tmp_dir , env = env )
114+ rc = process .wait ()
115+ if expected_result is None :
116+ return rc != 32512
117+ else :
118+ return rc == expected_result
111119 except FileNotFoundError :
112120 return False
113121
@@ -442,6 +450,9 @@ def has_dream(self):
442450 In order to be able to decode DRM broadcasts, OpenWebRX needs the "dream" DRM decoder. You can get it
443451 [here](https://sourceforge.net/projects/drm/files/dream/).
444452
453+ Note: Please use version 2.1.1, the latest version (2.2 at the time of writing) has been reported to cause
454+ problems.
455+
445456 The version supplied by most distributions will not work properly on the command line, so compiling from source
446457 with a custom set of commands is recommended:
447458
@@ -451,4 +462,4 @@ def has_dream(self):
451462 sudo make install
452463 ```
453464 """
454- return self .command_is_runnable ("dream --help" )
465+ return self .command_is_runnable ("dream --help" , 0 )
0 commit comments