We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
有些同学反馈 vscode 无法 debug egg 应用, 于是分析了下
在 vscode 的 debug 界面 launch 时:
node --debug-brk=21904 --nolazy index.js Debugger listening on [::]:21904 2016-09-29 08:15:12,277 INFO 52531 [master] =================== egg start ===================== 2016-09-29 08:15:12,278 INFO 52531 [master] egg version 0.1.3 2016-09-29 08:15:12,279 INFO 52531 [master] start with options: {"customEgg":"/Users/tz/Workspaces/eggjs/test/showcase/node_modules/.0.1.3@egg","baseDir":"/Users/tz/Workspaces/eggjs/test/showcase","port":7002,"workers":1,"plugins":null,"https":false,"key":"","cert":""} 2016-09-29 08:15:12,282 INFO 52531 [master] Agent Worker:52532 start with ["{\"customEgg\":\"/Users/tz/Workspaces/eggjs/test/showcase/node_modules/.0.1.3@egg\",\"baseDir\":\"/Users/tz/Workspaces/eggjs/test/showcase\",\"port\":7002,\"workers\":1,\"plugins\":null,\"https\":false,\"key\":\"\",\"cert\":\"\"}"] Debugger listening on [::]:5856
而正常的 egg 控制台启动日志, 除了上面那段外, 还会有以下:
2016-09-29 08:19:59,184 INFO 52849 [egg:watcher:agent] watcher start success 2016-09-29 08:19:59,219 INFO 52848 [master] Agent Worker started (404ms) 2016-09-29 08:19:59,223 INFO 52848 [master] App Worker#1:52850 start, state: none, current workers: ["1"] Debugger listening on [::]:19883 2016-09-29 08:19:59,897 WARN 52848 [master] App Worker#1:52850 started at 7002, remain 0 (678ms) 2016-09-29 08:19:59,897 INFO 52848 [master] egg started on http://127.0.0.1:7002 (1082ms)
--debug-brk
startCluster
process.execArgv[0] = process.execArgv[0].replace('-brk', '');
npm run dev
ps -ef|grep customEgg
egg-bin
--debug
node --debug index.js
egg-development
launch.json
思路:
目前进展:
vscode.commands.executeCommand('vscode.startDebug', {})
遇到问题:
vscode.startDebug
The text was updated successfully, but these errors were encountered:
想起了, 左耳朵耗子的这个微博: http://weibo.com/1401880315/Ea1F1zpoS
程序员解决问题时的情节:换个灯泡,发现架子松了,拿镙丝刀的时候,发现抽屉的滚轴要上油了,而油又没了,要开车去买,结果车又坏了……于是,老板骂到:“我只是让你换个灯泡,你TMD为什么在修车?!” Yak Shaving is bad for short term productivity, but it's incredible for long term growth.
程序员解决问题时的情节:换个灯泡,发现架子松了,拿镙丝刀的时候,发现抽屉的滚轴要上油了,而油又没了,要开车去买,结果车又坏了……于是,老板骂到:“我只是让你换个灯泡,你TMD为什么在修车?!”
Yak Shaving is bad for short term productivity, but it's incredible for long term growth.
视频地址: http://t.cn/RcEuAkQ
Sorry, something went wrong.
哈哈哈,程序员就是有这种毛病吧,要扫清眼前遇到的所有的障碍。
No branches or pull requests
背景
有些同学反馈 vscode 无法 debug egg 应用, 于是分析了下
流水账
启动时卡住
问题
在 vscode 的 debug 界面 launch 时:
而正常的 egg 控制台启动日志, 除了上面那段外, 还会有以下:
2016-09-29 08:19:59,184 INFO 52849 [egg:watcher:agent] watcher start success 2016-09-29 08:19:59,219 INFO 52848 [master] Agent Worker started (404ms) 2016-09-29 08:19:59,223 INFO 52848 [master] App Worker#1:52850 start, state: none, current workers: ["1"] Debugger listening on [::]:19883 2016-09-29 08:19:59,897 WARN 52848 [master] App Worker#1:52850 started at 7002, remain 0 (678ms) 2016-09-29 08:19:59,897 INFO 52848 [master] egg started on http://127.0.0.1:7002 (1082ms)
分析 && 处理
--debug-brk
把 master 进程挂住, 所以 agent 和 worker 都没起来startCluster
之前加入以下代码可以临时解决断点不了
问题
分析 && 处理
npm run dev
ps -ef|grep customEgg
后发现egg-bin
并没有传递--debug
给 workernode --debug index.js
, 晚点再修复下egg-bin
worker 自动重启怎么办?
问题
egg-development
监控到文件改变时, 会自动重启 workerlaunch.json
的端口, 然后重新 attach分析 && 处理
思路:
目前进展:
vscode.commands.executeCommand('vscode.startDebug', {})
这条指令, 可以成功的自动 attach遇到问题:
vscode.startDebug
这类 API 的文档, 根本不知道去哪里找... google 不到, 源码翻得很累The text was updated successfully, but these errors were encountered: