Skip to content

Commit b7e9790

Browse files
fix: --shell tests failing due to non-tty environment
2 parents 2f14733 + c2f13c4 commit b7e9790

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.github/workflows/test.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ on:
99
jobs:
1010
ShellTest:
1111
strategy:
12-
fail-fast: true
12+
fail-fast: false
1313
matrix:
1414
command:
15-
- go
1615
- aws
16+
- dotnet
17+
- go
18+
- java
19+
- node
20+
- perl
21+
- php
1722
- python
23+
- ruby
1824
- rustc
1925
- zip
2026
runs-on: ubuntu-latest
@@ -23,11 +29,11 @@ jobs:
2329
uses: actions/checkout@v2
2430
- name: Compile
2531
run: bin/dockerized --compile
26-
- name: "Test: dockerized --shell ${{matrix.command}}"
27-
env:
28-
COMMAND: "${{matrix.command}}"
32+
- name: "dockerized --shell ${{matrix.command}}"
33+
run: bin/dockerized -v --shell ${{matrix.command}} -c env | tee ~/shell.log
34+
- name: "Assert"
2935
run: |
30-
bin/dockerized --shell $COMMAND -c 'echo $HOST_HOSTNAME' | tee ~/shell.log
36+
echo "Test --shell"
3137
grep $(hostname) ~/shell.log
3238
IntegrationTest:
3339
runs-on: ubuntu-latest

main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
util "github.com/datastack-net/dockerized/pkg/util"
99
"github.com/docker/compose/v2/pkg/api"
1010
"github.com/fatih/color"
11+
"github.com/moby/term"
1112
"os"
1213
"path/filepath"
1314
"strings"
@@ -104,7 +105,7 @@ func RunCli(args []string) (err error, exitCode int) {
104105
},
105106
Command: commandArgs,
106107
AutoRemove: true,
107-
Tty: true,
108+
Tty: term.IsTerminal(os.Stdout.Fd()),
108109
WorkingDir: containerCwd,
109110
}
110111

0 commit comments

Comments
 (0)