File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -478,7 +478,11 @@ export class DockerClient {
478478 ) : Promise < void > {
479479 const response = await this . api . upgrade (
480480 `/containers/${ id } /attach` ,
481- options ,
481+ options || {
482+ stdout : stdout != null ,
483+ stderr : stderr != null ,
484+ stream : stdout != null || stderr != null ,
485+ } ,
482486 ) ;
483487 switch ( response . content ) {
484488 case DOCKER_RAW_STREAM :
@@ -1641,6 +1645,18 @@ export class DockerClient {
16411645 stderr : stream . Writable | null ,
16421646 execStartConfig ?: types . ExecStartConfig ,
16431647 ) : Promise < void > {
1648+ // If no output streams and Detach not explicitly set, force detached mode
1649+ if (
1650+ stdout === null &&
1651+ stderr === null &&
1652+ execStartConfig ?. Detach === undefined
1653+ ) {
1654+ await this . api . post ( `/exec/${ id } /start` , {
1655+ ...execStartConfig ,
1656+ Detach : true ,
1657+ } ) ;
1658+ return ;
1659+ }
16441660 if ( execStartConfig ?. Detach ) {
16451661 await this . api . post ( `/exec/${ id } /start` , execStartConfig ) ;
16461662 } else {
You can’t perform that action at this time.
0 commit comments