| 22 | }); |
| 23 | |
| 24 | function getBrowserEnv() { |
| 25 | // Attempt to honor this environment variable. |
| 26 | // It is specific to the operating system. |
| 27 | // See https://github.com/sindresorhus/open#app for documentation. |
| 28 | const value = process.env.BROWSER; |
| 29 | const args = process.env.BROWSER_ARGS |
| 30 | ? process.env.BROWSER_ARGS.split(' ') |
| 31 | : []; |
| 32 | let action; |
| 33 | if (!value) { |
| 34 | // Default. |
| 35 | action = Actions.BROWSER; |
| 36 | } else if (value.toLowerCase().endsWith('.js')) { |
| 37 | action = Actions.SCRIPT; |
| 38 | } else if (value.toLowerCase() === 'none') { |
| 39 | action = Actions.NONE; |
| 40 | } else { |
| 41 | action = Actions.BROWSER; |
| 42 | } |
| 43 | return { action, value, args }; |
| 44 | } |
| 45 | |
| 46 | function executeNodeScript(scriptPath, url) { |
| 47 | const extraArgs = process.argv.slice(2); |