6767# If a remote command was requested, execute it inside the dev container.
6868if [ -n "${SSH_ORIGINAL_COMMAND:-}" ]; then
6969 if nsenter --target "$DEV_PID" --mount -- test -x /bin/bash 2>/dev/null; then
70- exec nsenter --target "$DEV_PID" --mount --uts --ipc --pid -- /bin/bash -lc "$SSH_ORIGINAL_COMMAND"
70+ exec nsenter --target "$DEV_PID" --mount --uts --ipc --pid --cgroup -- /bin/bash -lc "$SSH_ORIGINAL_COMMAND"
7171 else
72- exec nsenter --target "$DEV_PID" --mount --uts --ipc --pid -- /bin/sh -lc "$SSH_ORIGINAL_COMMAND"
72+ exec nsenter --target "$DEV_PID" --mount --uts --ipc --pid --cgroup -- /bin/sh -lc "$SSH_ORIGINAL_COMMAND"
7373 fi
7474fi
7575
7676# If there is no TTY and no remote command (e.g. SSH master/control session),
7777# keep the connection open so forwarding channels stay alive.
7878if [ ! -t 0 ]; then
79- exec nsenter --target "$DEV_PID" --mount --uts --ipc --pid -- /bin/sh -lc "while :; do sleep 3600; done"
79+ exec nsenter --target "$DEV_PID" --mount --uts --ipc --pid --cgroup -- /bin/sh -lc "while :; do sleep 3600; done"
8080fi
8181
8282# Run postAttach script for interactive sessions when present.
8383if [ -n "${OKDEV_WORKSPACE_PATH:-}" ]; then
8484 POST_ATTACH="${OKDEV_WORKSPACE_PATH}/.okdev/post-attach.sh"
8585 if nsenter --target "$DEV_PID" --mount -- test -x "$POST_ATTACH" 2>/dev/null; then
86- nsenter --target "$DEV_PID" --mount --uts --ipc --pid -- "$POST_ATTACH" 2>&1 || \
86+ nsenter --target "$DEV_PID" --mount --uts --ipc --pid --cgroup -- "$POST_ATTACH" 2>&1 || \
8787 echo "warning: postAttach script failed" >&2
8888 fi
8989fi
@@ -102,17 +102,17 @@ if [ "${OKDEV_TMUX_FLAG:-}" = "1" ] && [ "${OKDEV_NO_TMUX:-}" != "1" ] && comman
102102 # process is killed by sshd, while the server keeps the session alive.
103103 if ! tmux has-session -t okdev 2>/dev/null; then
104104 if nsenter --target "$DEV_PID" --mount -- test -x /bin/bash 2>/dev/null; then
105- tmux new-session -d -s okdev "nsenter --target $DEV_PID --mount --uts --ipc --pid -- /bin/bash -l"
105+ tmux new-session -d -s okdev "nsenter --target $DEV_PID --mount --uts --ipc --pid --cgroup -- /bin/bash -l"
106106 else
107- tmux new-session -d -s okdev "nsenter --target $DEV_PID --mount --uts --ipc --pid -- /bin/sh -l"
107+ tmux new-session -d -s okdev "nsenter --target $DEV_PID --mount --uts --ipc --pid --cgroup -- /bin/sh -l"
108108 fi
109109 fi
110110 exec tmux attach-session -t okdev
111111fi
112112if nsenter --target "$DEV_PID" --mount -- test -x /bin/bash 2>/dev/null; then
113- exec nsenter --target "$DEV_PID" --mount --uts --ipc --pid -- /bin/bash -l
113+ exec nsenter --target "$DEV_PID" --mount --uts --ipc --pid --cgroup -- /bin/bash -l
114114else
115- exec nsenter --target "$DEV_PID" --mount --uts --ipc --pid -- /bin/sh -l
115+ exec nsenter --target "$DEV_PID" --mount --uts --ipc --pid --cgroup -- /bin/sh -l
116116fi
117117SCRIPT
118118safe_tmux_flag=$( printf ' %s' " $OKDEV_TMUX_FLAG " | sed ' s/[\/&]/\\&/g' )
0 commit comments