(server)
| 268 | key: 'p', |
| 269 | description: 'start/stop the profiler', |
| 270 | async action(server) { |
| 271 | if (profileSession) { |
| 272 | await stopProfiler(server.config.logger.info) |
| 273 | } else { |
| 274 | const inspector = await import('node:inspector').then( |
| 275 | (r) => r.default, |
| 276 | ) |
| 277 | await new Promise<void>((res) => { |
| 278 | profileSession = new inspector.Session() |
| 279 | profileSession.connect() |
| 280 | profileSession.post('Profiler.enable', () => { |
| 281 | profileSession!.post('Profiler.start', () => { |
| 282 | server.config.logger.info('Profiler started') |
| 283 | res() |
| 284 | }) |
| 285 | }) |
| 286 | }) |
| 287 | } |
| 288 | }, |
| 289 | }) |
| 290 | } |
| 291 | server.bindCLIShortcuts({ print: true, customShortcuts }) |
nothing calls this directly
no test coverage detected