async function trapOutput(stdout, stderr) {
  /** @type {Buffer[]} */
  const stdoutChunks = []
  /** @type {Buffer[]} */
  const stderrChunks = []

  return Promise.all([
    new Promise((resolve, reject) => {
      stdout
        .on('data', (chunk) => {
          stdoutChunks.push(Buffer.from(chunk))
        })
        .on('end', () => {
          resolve(Buffer.concat(stdoutChunks).toString('utf8'))
        })
        .on('error', reject)
    }),
    new Promise((resolve, reject) => {
      stderr
        .on('data', (chunk) => {
          stderrChunks.push(Buffer.from(chunk))
        })
        .on('end', () => {
          resolve(Buffer.concat(stderrChunks).toString('utf8'))
        })
        .on('error', reject)
    }),
  ])
}
@param {NodeJS.ReadableStream} stdout
@param {NodeJS.ReadableStream} stderr
@returns {Promise<[stdout: string, stderr: string]>}