Skip to content

Conversation

@michaeldwan
Copy link
Member

@michaeldwan michaeldwan commented May 8, 2025

Multiplexing stderr to a buffer accidentally broke TTY detection in docker when ran as a subprocess. This PR restores it by creating a pty/tty for the subprocess when necessary.

Also fixes:

  • --progress was not being passed to the second build step.
  • stops using a deprecated flag on the docker cli that was causing a warning

Before

$ go run ../../../../cmd/cog build -t cog-test
Building Docker image from environment in cog.yaml as cog-test...
#0 building with "desktop-linux" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 560B done
#1 DONE 0.0s

#2 [auth] docker/dockerfile:pull token for registry-1.docker.io
#2 DONE 0.0s
...

After

❯ go run ../../../../cmd/cog build -t cog-test
Building Docker image from environment in cog.yaml as cog-test...
[+] Building 0.5s (12/12) FINISHED                         docker:desktop-linux
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 560B                                       0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1  0.1s
...

Multiplexing stderr to a buffer accidentally broke TTY detection in docker. This PR restores it by using a pipe instead of a wrapper.

Also fixed `--progress` not being passed to the second build step.
@michaeldwan michaeldwan requested a review from a team May 8, 2025 23:46
@michaeldwan michaeldwan merged commit da5c486 into main May 12, 2025
21 checks passed
@michaeldwan michaeldwan deleted the md/fix-build-output branch May 12, 2025 18:29
danfairs pushed a commit to condensereality/cog that referenced this pull request May 14, 2025
* Fix build output

Multiplexing stderr to a buffer accidentally broke TTY detection in docker. This PR restores it by using a pipe instead of a wrapper.

Also fixed `--progress` not being passed to the second build step.

* fix potential stderr/stdout deadlock

* only use pty if error writer is a tty

* fix deprecation warning

* container stop prints the id, discard it

* out goes to stderr unless a writer is provided
Signed-off-by: Dan Fairs <[email protected]>
danfairs pushed a commit to condensereality/cog that referenced this pull request May 14, 2025
* Fix build output

Multiplexing stderr to a buffer accidentally broke TTY detection in docker. This PR restores it by using a pipe instead of a wrapper.

Also fixed `--progress` not being passed to the second build step.

* fix potential stderr/stdout deadlock

* only use pty if error writer is a tty

* fix deprecation warning

* container stop prints the id, discard it

* out goes to stderr unless a writer is provided
Signed-off-by: Dan Fairs <[email protected]>
danfairs pushed a commit to condensereality/cog that referenced this pull request May 14, 2025
* Fix build output

Multiplexing stderr to a buffer accidentally broke TTY detection in docker. This PR restores it by using a pipe instead of a wrapper.

Also fixed `--progress` not being passed to the second build step.

* fix potential stderr/stdout deadlock

* only use pty if error writer is a tty

* fix deprecation warning

* container stop prints the id, discard it

* out goes to stderr unless a writer is provided
Signed-off-by: Dan Fairs <[email protected]>
danfairs pushed a commit to condensereality/cog that referenced this pull request May 14, 2025
* Fix build output

Multiplexing stderr to a buffer accidentally broke TTY detection in docker. This PR restores it by using a pipe instead of a wrapper.

Also fixed `--progress` not being passed to the second build step.

* fix potential stderr/stdout deadlock

* only use pty if error writer is a tty

* fix deprecation warning

* container stop prints the id, discard it

* out goes to stderr unless a writer is provided
Signed-off-by: Dan Fairs <[email protected]>
danfairs pushed a commit to condensereality/cog that referenced this pull request May 14, 2025
* Fix build output

Multiplexing stderr to a buffer accidentally broke TTY detection in docker. This PR restores it by using a pipe instead of a wrapper.

Also fixed `--progress` not being passed to the second build step.

* fix potential stderr/stdout deadlock

* only use pty if error writer is a tty

* fix deprecation warning

* container stop prints the id, discard it

* out goes to stderr unless a writer is provided
Signed-off-by: Dan Fairs <[email protected]>
danfairs pushed a commit to condensereality/cog that referenced this pull request May 14, 2025
* Fix build output

Multiplexing stderr to a buffer accidentally broke TTY detection in docker. This PR restores it by using a pipe instead of a wrapper.

Also fixed `--progress` not being passed to the second build step.

* fix potential stderr/stdout deadlock

* only use pty if error writer is a tty

* fix deprecation warning

* container stop prints the id, discard it

* out goes to stderr unless a writer is provided
Signed-off-by: Dan Fairs <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants