Class for all browsers started with a command and without remote functionality.
| 171 | |
| 172 | |
| 173 | class GenericBrowser(BaseBrowser): |
| 174 | """Class for all browsers started with a command |
| 175 | and without remote functionality.""" |
| 176 | |
| 177 | def __init__(self, name): |
| 178 | if isinstance(name, str): |
| 179 | self.name = name |
| 180 | self.args = ["%s"] |
| 181 | else: |
| 182 | # name should be a list with arguments |
| 183 | self.name = name[0] |
| 184 | self.args = name[1:] |
| 185 | self.basename = os.path.basename(self.name) |
| 186 | |
| 187 | def open(self, url, new=0, autoraise=True): |
| 188 | sys.audit("webbrowser.open", url) |
| 189 | self._check_url(url) |
| 190 | cmdline = [self.name] + [arg.replace("%s", url) |
| 191 | for arg in self.args] |
| 192 | try: |
| 193 | if sys.platform[:3] == 'win': |
| 194 | p = subprocess.Popen(cmdline) |
| 195 | else: |
| 196 | p = subprocess.Popen(cmdline, close_fds=True) |
| 197 | return not p.wait() |
| 198 | except OSError: |
| 199 | return False |
| 200 | |
| 201 | |
| 202 | class BackgroundBrowser(GenericBrowser): |
no outgoing calls
no test coverage detected
searching dependent graphs…