Skip to content

Commit 48dd4d5

Browse files
committed
Merge remote-tracking branch 'origin/main' into dean/proxy-regions-endpoint
2 parents b88a727 + 6e8ff2d commit 48dd4d5

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

dogfood/main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,8 @@ resource "docker_container" "workspace" {
157157
image = docker_image.dogfood.name
158158
name = local.container_name
159159
# Hostname makes the shell more user friendly: coder@my-workspace:~$
160-
hostname = data.coder_workspace.me.name
161-
# Use the docker gateway if the access URL is 127.0.0.1
162-
entrypoint = ["sh", "-c", replace(coder_agent.dev.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")]
160+
hostname = data.coder_workspace.me.name
161+
entrypoint = ["sh", "-c", coder_agent.dev.init_script]
163162
# CPU limits are unnecessary since Docker will load balance automatically
164163
memory = 32768
165164
runtime = "sysbox-runc"

examples/templates/kubernetes/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ resource "coder_agent" "main" {
117117
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.11.0
118118
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
119119
EOT
120-
121120
}
122121

123122
# code-server

pty/start_other.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,25 @@ func startPty(cmd *exec.Cmd, opt ...StartOption) (retPTY *otherPty, proc Process
5050
}
5151
return nil, nil, xerrors.Errorf("start: %w", err)
5252
}
53-
// Now that we've started the command, and passed the TTY to it, close our
54-
// file so that the other process has the only open file to the TTY. Once
55-
// the process closes the TTY (usually on exit), there will be no open
56-
// references and the OS kernel returns an error when trying to read or
57-
// write to our PTY end. Without this, reading from the process output
58-
// will block until we close our TTY.
59-
if err := opty.tty.Close(); err != nil {
60-
_ = cmd.Process.Kill()
61-
return nil, nil, xerrors.Errorf("close tty: %w", err)
53+
if runtime.GOOS == "linux" {
54+
// Now that we've started the command, and passed the TTY to it, close
55+
// our file so that the other process has the only open file to the TTY.
56+
// Once the process closes the TTY (usually on exit), there will be no
57+
// open references and the OS kernel returns an error when trying to
58+
// read or write to our PTY end. Without this (on Linux), reading from
59+
// the process output will block until we close our TTY.
60+
//
61+
// Note that on darwin, reads on the PTY don't block even if we keep the
62+
// TTY file open, and keeping it open seems to prevent race conditions
63+
// where we lose output. Couldn't find official documentation
64+
// confirming this, but I did find a thread of someone else's
65+
// observations: https://developer.apple.com/forums/thread/663632
66+
if err := opty.tty.Close(); err != nil {
67+
_ = cmd.Process.Kill()
68+
return nil, nil, xerrors.Errorf("close tty: %w", err)
69+
}
70+
opty.tty = nil // remove so we don't attempt to close it again.
6271
}
63-
opty.tty = nil // remove so we don't attempt to close it again.
6472
oProcess := &otherProcess{
6573
pty: opty.pty,
6674
cmd: cmd,

0 commit comments

Comments
 (0)