Skip to content

Commit

Permalink
fix opening styled url in the browser after start command is done
Browse files Browse the repository at this point in the history
  • Loading branch information
ejnshtein committed Nov 17, 2022
1 parent 0f31419 commit b27b742
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion build-packages/magento-scripts/lib/util/open-browser.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
const { execAsync } = require('./exec-async')

// eslint-disable-next-line no-control-regex
const consoleStyleReplacer = /[\u001b]\[\S+?m/g
/**
* @param {string} url
*/
const openBrowser = async (url) => {
const start = process.platform === 'darwin' ? 'open' : 'xdg-open'

await execAsync(`${start} ${url}`)
await execAsync(`${start} ${url.replace(consoleStyleReplacer, '')}`)
}

module.exports = openBrowser

0 comments on commit b27b742

Please sign in to comment.