@@ -7,10 +7,11 @@ import * as http from 'http';
77import Dockerode from 'dockerode' ;
88import getRawBody from 'raw-body' ;
99import { AbortController } from 'node-abort-controller' ;
10+ import { makeDestroyable , DestroyableServer } from 'destroyable-server' ;
1011
1112import { chmod , deleteFile , readDir } from '../../util/fs' ;
1213import { rawHeadersToHeaders } from '../../util/http' ;
13- import { makeDestroyable , DestroyableServer } from 'destroyable-server ' ;
14+ import { streamToBuffer } from '../../util/stream ' ;
1415import { reportError } from '../../error-tracking' ;
1516import { addShutdownHandler } from '../../shutdown' ;
1617
@@ -212,12 +213,7 @@ async function createDockerProxy(
212213 dockerRes . pipe ( getBuildOutputPipeline ( await extraDockerCommandCount ! ) ) . pipe ( res ) ;
213214 } else if ( shouldRemapContainerData ) {
214215 // We need to remap container data, to hook all docker-compose behaviour:
215- const data = await new Promise < Buffer > ( ( resolve , reject ) => {
216- const dataChunks : Buffer [ ] = [ ] ;
217- dockerRes . on ( 'data' , ( d ) => dataChunks . push ( d ) ) ;
218- dockerRes . on ( 'end' , ( ) => resolve ( Buffer . concat ( dataChunks ) ) ) ;
219- dockerRes . on ( 'error' , reject ) ;
220- } ) ;
216+ const data = await streamToBuffer ( dockerRes ) ;
221217
222218 try {
223219 if ( isComposeContainerQuery ) {
0 commit comments