From c2f13c4abeae5526e68cae9d615f2410a687c771 Mon Sep 17 00:00:00 2001 From: Bouke Versteegh Date: Wed, 20 Apr 2022 14:37:38 +0200 Subject: [PATCH] fix: --shell tests failing due to non-tty environment fixes #39 --- .github/workflows/test.yml | 18 ++++++++++++------ main.go | 3 ++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 351bb16..c6fb68a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,12 +9,18 @@ on: jobs: ShellTest: strategy: - fail-fast: true + fail-fast: false matrix: command: - - go - aws + - dotnet + - go + - java + - node + - perl + - php - python + - ruby - rustc - zip runs-on: ubuntu-latest @@ -23,11 +29,11 @@ jobs: uses: actions/checkout@v2 - name: Compile run: bin/dockerized --compile - - name: "Test: dockerized --shell ${{matrix.command}}" - env: - COMMAND: "${{matrix.command}}" + - name: "dockerized --shell ${{matrix.command}}" + run: bin/dockerized -v --shell ${{matrix.command}} -c env | tee ~/shell.log + - name: "Assert" run: | - bin/dockerized --shell $COMMAND -c 'echo $HOST_HOSTNAME' | tee ~/shell.log + echo "Test --shell" grep $(hostname) ~/shell.log IntegrationTest: runs-on: ubuntu-latest diff --git a/main.go b/main.go index 50d2562..1d9feaa 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( util "github.com/datastack-net/dockerized/pkg/util" "github.com/docker/compose/v2/pkg/api" "github.com/fatih/color" + "github.com/moby/term" "os" "path/filepath" "strings" @@ -104,7 +105,7 @@ func RunCli(args []string) (err error, exitCode int) { }, Command: commandArgs, AutoRemove: true, - Tty: true, + Tty: term.IsTerminal(os.Stdout.Fd()), WorkingDir: containerCwd, }