1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 01:57:32 +08:00

If instance doesn't exist don't try to connect to its terminal

This commit is contained in:
Jonathan Leibiusky (@xetorthio) 2016-11-11 09:16:01 -03:00
parent b5e016e6f5
commit 6d967441ac
2 changed files with 2 additions and 2 deletions

View File

@ -1,3 +1,3 @@
#!/bin/bash
docker build -t builder .&& docker run --rm builder | sudo docker build -t franela/play-with-docker:master -
docker build -t builder .&& docker run --rm builder | sudo docker build -t franela/play-with-docker:latest -

View File

@ -25,7 +25,7 @@ func NewClient(so socketio.Socket, session *Session) *Client {
so.On("terminal in", func(name, data string) {
// User wrote something on the terminal. Need to write it to the instance terminal
instance := GetInstance(session, name)
if len(data) > 0 {
if instance != nil && len(data) > 0 {
instance.Conn.Conn.Write([]byte(data))
}
})