Make sure to stop any spawned tty sessions on container stop.

This commit is contained in:
Pagan Gazzard 2014-08-19 13:45:53 +01:00 committed by Pablo Carranza Vélez
parent ad107b30ae
commit c1b1aba985

View File

@ -10,6 +10,7 @@ Promise = require 'bluebird'
JSONStream = require 'JSONStream' JSONStream = require 'JSONStream'
PlatformAPI = require 'resin-platform-api/request' PlatformAPI = require 'resin-platform-api/request'
utils = require './utils' utils = require './utils'
tty = require './tty'
PLATFORM_ENDPOINT = url.resolve(config.apiEndpoint, '/ewa/') PLATFORM_ENDPOINT = url.resolve(config.apiEndpoint, '/ewa/')
resinAPI = new PlatformAPI(PLATFORM_ENDPOINT) resinAPI = new PlatformAPI(PLATFORM_ENDPOINT)
@ -44,6 +45,9 @@ exports.kill = kill = (app) ->
updateDeviceInfo(status: 'Stopping') updateDeviceInfo(status: 'Stopping')
container = docker.getContainer(app.containerId) container = docker.getContainer(app.containerId)
console.log('Stopping and deleting container:', container) console.log('Stopping and deleting container:', container)
tty.stop()
.catch(->) # Even if stopping the tty fails we want to finish stopping the container
.then ->
container.stopAsync() container.stopAsync()
.then -> .then ->
container.removeAsync() container.removeAsync()