<commit_before>var docker = require('../lib/docker')();

var removeTask = module.exports = function() {
    'use strict';

    var packageName = docker.packageManifest.name;

    this.report('message', '[%s] removing containers', packageName);

    return docker.findPackageContainers()
        .then(function(containers) {

            var promises = [];

            containers.forEach(function(container) {

                this.report('message', '    | %s: removing %s', container.manifest.name, container.name);

                var promise = Promise.denodeify(container.inspect).bind(container)()
                    .then(function(data) {
                        if (data.State.Running) {
                            return Promise.denodeify(container.stop).bind(container)();
                        }
                    })
                    .then(function() {
                        return Promise.denodeify(container.remove).bind(container)();
                    });

                promises.push(promise);
<commit_msg>fixed error if container to remove is not valid<commit_after>var docker = require('../lib/docker')();

var removeTask = module.exports = function() {
    'use strict';

    if (!docker.packageManifest) {
        return;
    }

    var packageName = docker.packageManifest.name;

    this.report('message', '[%s] removing containers', packageName);

    return docker.findPackageContainers()
        .then(function(containers) {

            var promises = [];

            containers.forEach(function(container) {

                this.report('message', '    | %s: removing %s', container.manifest.name, container.name);

                var promise = Promise.denodeify(container.inspect).bind(container)()
                    .then(function(data) {
                        if (data.State.Running) {
                            return Promise.denodeify(container.stop).bind(container)();
                        }
                    })
                    .then(function() {
                        return Promise.denodeify(container.remove).bind(container)();
                    });

                promises.push(promise);

{'fraction_non_alphanumeric': 0.1244218316373728, 'fraction_numerical': 0.0, 'mean_word_length': 1.7589285714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4284958', 'n_tokens_mistral': 556, 'n_tokens_neox': 514, 'n_words': 93}