little fix: fail outside of socket connection
This commit is contained in:
		@@ -17,6 +17,10 @@ module.exports = function(io) {
 | 
			
		||||
        proc.exec(cmd, callback);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function fail(txt, data) {
 | 
			
		||||
        console.log("** "+txt, data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var oldcontainer = null;
 | 
			
		||||
    function containerinspect(error, stdout, stderr) {
 | 
			
		||||
        if (error || stderr)
 | 
			
		||||
@@ -96,7 +100,7 @@ module.exports = function(io) {
 | 
			
		||||
 | 
			
		||||
        function modify(cmd, name) {
 | 
			
		||||
            if (!name.match(/^[a-z0-9][-_:.+a-z0-9]*$/i))
 | 
			
		||||
                return fail("illegal instance name");
 | 
			
		||||
                return this.fail("illegal instance name");
 | 
			
		||||
            exec("docker "+cmd+" "+name, updatecontainers);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -104,7 +108,7 @@ module.exports = function(io) {
 | 
			
		||||
            if (cmds.length>0)
 | 
			
		||||
                exec(cmds.shift(), function(error, stdout, stderr) {
 | 
			
		||||
                    if (error || stderr)
 | 
			
		||||
                        return fail("create container failed", {
 | 
			
		||||
                        return this.fail("create container failed", {
 | 
			
		||||
                            error: error, stderr: stderr, stdout: stdout
 | 
			
		||||
                        });
 | 
			
		||||
                    createContainer(cmds);
 | 
			
		||||
@@ -175,7 +179,7 @@ module.exports = function(io) {
 | 
			
		||||
 | 
			
		||||
        function new_bash(name) {
 | 
			
		||||
            if (!name.match(/^[a-z0-9][-_:.+a-z0-9]*$/i))
 | 
			
		||||
                return fail("illegal instance name");
 | 
			
		||||
                return this.fail("illegal instance name");
 | 
			
		||||
            if (bash_connections[name]) return;
 | 
			
		||||
            bash_connections[name] =
 | 
			
		||||
                pty.spawn("docker", ["exec", "-it", name, "bash", "-i"]);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user