Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for node 8 ws urls #53

Merged
merged 4 commits into from Jul 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -10,6 +10,7 @@ addons:
language: node_js
node_js:
- 7.1.0
- 8.1

before_script:
- export DBUS_SESSION_BUS_ADDRESS=/dev/null
Expand Down
8 changes: 7 additions & 1 deletion lib/index.js
Expand Up @@ -88,13 +88,19 @@ const inspectProcess = function (cmd, options, devtools) {
proc.stderr.on('data', (data) => {
const dataStr = data.toString()
const isListening = dataStr.startsWith('Debugger listening on port')
const isListeningWs = dataStr.startsWith('Debugger listening on ws://')
const isAttached = dataStr.startsWith('Debugger attached')
const isCompleted = dataStr.startsWith('Waiting for the debugger to disconnect')
const isInspectOutput = isListening || isCompleted || isAttached
const DebugBrkDeprecation = dataStr.indexOf('DeprecationWarning: `node --inspect --debug-brk` is deprecated. Please use `node --inspect-brk` instead.') !== -1
const isInspectOutput = isListening || isListeningWs || isCompleted || isAttached || DebugBrkDeprecation

if (isListening) {
log.silly('process: listening')
openDevtools(dataStr.substring(dataStr.indexOf('chrome-devtools')))
} else if (isListeningWs) {
log.silly('process: listening')
const wsUrl = dataStr.match(/ws:\/\/(.*?)\s/)[1]
openDevtools(`chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=${wsUrl}`)
} else if (isCompleted && devtoolsOpen) {
log.silly('process: completed')
closeDevtools()
Expand Down