Merge pull request #1069 from weaveworks/1053-use-default-shell

Try to figure out the most suitable shell to use
This commit is contained in:
Tom Wilkie
2016-03-02 10:58:31 +00:00
3 changed files with 9 additions and 2 deletions

View File

@@ -152,4 +152,5 @@ deps:
$(GO) get -u -f -tags $(GO_BUILD_TAGS) \
github.com/FiloSottile/gvt \
github.com/mattn/goveralls \
github.com/weaveworks/github-release
github.com/weaveworks/github-release \
github.com/2opremio/trifles/wscat

View File

@@ -14,6 +14,12 @@ wait_for_containers $HOST1 60 alpine
assert "docker_on $HOST1 inspect --format='{{.State.Running}}' alpine" "true"
PROBEID=$(docker_on $HOST1 logs weavescope 2>&1 | grep "probe starting" | sed -n 's/^.*ID \([0-9a-f]*\)$/\1/p')
HOSTID=$(echo $HOST1 | cut -d"." -f1)
# Execute 'echo foo' in a container tty and check its output
PIPEID=$(curl -s -f -X POST "http://$HOST1:4040/api/control/$PROBEID/$CID;<container>/docker_exec_container" | jq -r '.pipe' )
assert "(sleep 1 && echo 'echo foo' && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb" "/ # 6necho foo\nfoo\n/ # 6n"
assert_raises "curl -f -X POST 'http://$HOST1:4040/api/control/$PROBEID/$CID;<container>/docker_stop_container'"
sleep 5

View File

@@ -99,7 +99,7 @@ func (r *registry) execContainer(containerID string, req xfer.Request) xfer.Resp
AttachStdout: true,
AttachStderr: true,
Tty: true,
Cmd: []string{"/bin/sh", "-c", "TERM=xterm exec /bin/sh"},
Cmd: []string{"/bin/sh", "-c", "TERM=xterm exec $( (type getent > /dev/null 2>&1 && getent passwd root | cut -d: -f7 2>/dev/null) || echo /bin/sh)"},
Container: containerID,
})
if err != nil {