forked from EvergreenCrypto/docker-finance
client: src: lib_docker: run: only allocate TTY when needed
Fixes running with client (host) cron.
This commit is contained in:
@@ -394,9 +394,14 @@ function lib_docker::__run()
|
||||
lib_utils::print_debug "Creating network"
|
||||
docker network create "$global_network" &>/dev/null
|
||||
|
||||
# NOTE: runs bash as interactive so .bashrc doesn't `return` (sources/aliases are needed)
|
||||
lib_utils::print_debug "Spawning container with command '$*'"
|
||||
lib_docker::__docker_compose run -it --rm --entrypoint='/bin/bash -i -c' docker-finance "$@"
|
||||
|
||||
# Terminal requirements (e.g., for cron, don't allocate TTY)
|
||||
local _tty
|
||||
test -t 1 && _tty="t"
|
||||
|
||||
# NOTE: runs bash as interactive so .bashrc doesn't `return` (sources/aliases are needed)
|
||||
lib_docker::__docker_compose run -i"${_tty}" --rm --entrypoint='/bin/bash -i -c' docker-finance "$@"
|
||||
local -r _return=$?
|
||||
|
||||
lib_utils::print_debug "Removing network"
|
||||
|
||||
Reference in New Issue
Block a user