stdout can be null according to the documentation.
|
/** |
|
* Start an exec instance |
|
* @param id Exec instance ID |
|
* @param stdout Optional stream to write stdout content |
|
* @param stderr Optional stream to write stderr content |
|
* @param execStartConfig Configuration options for starting the exec instance |
|
* @returns Promise that resolves when the exec instance completes |
|
*/ |
|
public async execStart( |
|
id: string, |
|
stdout: stream.Writable | null, |
|
stderr: stream.Writable | null, |
|
execStartConfig?: types.ExecStartConfig, |
|
): Promise<void> { |
But when it is null an error is thrown stating stdout is required to process stream.
|
if (isWritable(stdout)) { |
|
const response = await this.api.upgrade( |
|
`/exec/${id}/start`, |
|
execStartConfig, |
|
); |
|
switch (response.content) { |
|
case DOCKER_RAW_STREAM: |
|
response.socket.pipe(stdout); |
|
break; |
|
case DOCKER_MULTIPLEXED_STREAM: |
|
if (isWritable(stderr)) { |
|
response.socket.pipe( |
|
demultiplexStream(stdout, stderr), |
|
); |
|
break; |
|
} else { |
|
throw new Error( |
|
'stderr is required to process multiplexed stream', |
|
); |
|
} |
|
default: |
|
throw new Error( |
|
'Unsupported content type: ' + response.content, |
|
); |
|
} |
|
return new Promise((resolve, reject) => { |
|
response.socket.once('error', reject); |
|
response.socket.once('close', resolve); |
|
}); |
|
} else { |
|
throw new Error('stdout is required to process stream'); |
|
} |
stdoutcan benullaccording to the documentation.node-sdk/lib/docker-client.ts
Lines 1630 to 1643 in 47ac3bc
But when it is
nullan error is thrown statingstdout is required to process stream.node-sdk/lib/docker-client.ts
Lines 1647 to 1678 in 47ac3bc