Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit 28940b2

Browse files
committed
Fixed TTY issue.
1 parent 3833420 commit 28940b2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cli/commands/container

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,15 @@ d_shell()
312312
error_cni
313313
else
314314
# echo "$ECHO_PREFIX ${GREEN}Shell to container: ${CYAN}${IMAGE}${RESET}" 1>&2
315-
docker run --name ${CONTAINER_NAME}-shell --rm -i -t ${IMAGE_NETWORK} ${IMAGE_ARGS} ${IMAGE_VOLUMES} ${IMAGE} "$@"
315+
if [ -t 0 ]
316+
then
317+
# TTY allocated.
318+
docker run --name ${CONTAINER_NAME}-shell --rm -i -t ${IMAGE_NETWORK} ${IMAGE_ARGS} ${IMAGE_VOLUMES} ${IMAGE} "$@"
319+
else
320+
# TTY not allocated.
321+
docker run --name ${CONTAINER_NAME}-exec --rm -i ${IMAGE_NETWORK} ${IMAGE_ARGS} ${IMAGE_VOLUMES} ${IMAGE} "$@"
322+
fi
323+
316324
if [ "$?" == "1" ]
317325
then
318326
error_ccbi

0 commit comments

Comments
 (0)