(cmd: PlatformSwitch<string>, options?: { logLevel?: LogLevel; logOutput?: boolean | 'continuous' | 'silent'; stdin?: Buffer })
| 51 | |
| 52 | let lastExec: Promise<any> | undefined; |
| 53 | async function exec(cmd: PlatformSwitch<string>, options?: { logLevel?: LogLevel; logOutput?: boolean | 'continuous' | 'silent'; stdin?: Buffer }) { |
| 54 | const currentExec = lastExec = (async () => { |
| 55 | try { |
| 56 | await lastExec; |
| 57 | } catch (err) { |
| 58 | // ignore |
| 59 | } |
| 60 | return _exec(platformDispatch(platform, cmd), options); |
| 61 | })(); |
| 62 | try { |
| 63 | return await Promise.race([currentExec, monitor.unexpectedExit]); |
| 64 | } finally { |
| 65 | monitor.disposeStdioListeners(); |
| 66 | if (lastExec === currentExec) { |
| 67 | lastExec = undefined; |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | async function _exec(cmd: string, options?: { logLevel?: LogLevel; logOutput?: boolean | 'continuous' | 'silent'; stdin?: Buffer }) { |
| 73 | const text = `Run in ${hostName.toLowerCase()}: ${cmd.replace(/\n.*/g, '')}`; |
no test coverage detected