Skip to content

Commit

Permalink
#168 Fix browser not opening on Windows when using the CLI (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
spillerrec authored Sep 14, 2020
1 parent 64fe369 commit 069c019
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
8 changes: 6 additions & 2 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs')
const os = require('os')
const stream = require('stream')

const opn = require('opn')
const open = require('open')

const helpString = `Usage: speedscope [filepath]
Expand Down Expand Up @@ -89,7 +89,11 @@ async function main() {

console.log('Opening', urlToOpen, 'in your default browser')

await opn(urlToOpen, {wait: false})
// We'd like to avoid blocking the terminal on the browsing closing,
// but for some reason this doesn't work at all on Windows if we
// don't use wait: true.
const wait = process.platform === "win32";
await open(urlToOpen, {wait})
}

main()
Expand Down
30 changes: 28 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
]
},
"dependencies": {
"opn": "5.3.0",
"open": "7.2.0",
"react": "^16.13.1"
}
}

0 comments on commit 069c019

Please sign in to comment.