* Reads the BROWSER environment variable and decides what to do with it. Returns * true if it opened a browser or ran a node.js script, otherwise false.
(url)
| 136 | * true if it opened a browser or ran a node.js script, otherwise false. |
| 137 | */ |
| 138 | function openBrowser(url) { |
| 139 | const { action, value, args } = getBrowserEnv(); |
| 140 | switch (action) { |
| 141 | case Actions.NONE: |
| 142 | // Special case: BROWSER="none" will prevent opening completely. |
| 143 | return false; |
| 144 | case Actions.SCRIPT: |
| 145 | return executeNodeScript(value, url); |
| 146 | case Actions.BROWSER: |
| 147 | return startBrowserProcess(value, url, args); |
| 148 | default: |
| 149 | throw new Error('Not implemented.'); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | module.exports = openBrowser; |
no test coverage detected