()
| 64 | } |
| 65 | |
| 66 | private async runReportHandler() { |
| 67 | if (!this.command.report) throw new Error('runReportHandler expects command.report to be implemented'); |
| 68 | const result = await this.command.report(this.args, this.flags); |
| 69 | loader.off(); |
| 70 | const data = typeof result === 'string' ? result : result.data; |
| 71 | const exitCode = typeof result === 'string' ? 0 : result.code; |
| 72 | return this.writeAndExit(`${data}\n`, exitCode); |
| 73 | } |
| 74 | |
| 75 | private writeAndExit(data: string, exitCode: number) { |
| 76 | return process.stdout.write(data, () => logger.exitAfterFlush(exitCode, this.command.name)); |
no test coverage detected