diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index f6e4e3b0..4a09ddb0 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -66,6 +66,7 @@ function logToFile(message){ module.exports = function setup(fsOptions) { var pty; if (!fsOptions.nopty) { + // on darwin trying to load binary for a wrong version crashes the process [process.env.HOME + "/.c9/node_modules/pty.js", "pty.js", "pty.nw.js"].some(function(p) { try { pty = require(p); @@ -1465,15 +1466,15 @@ module.exports = function setup(fsOptions) { } if (options.resumeStdin) child.stdin.resume(); if (options.hasOwnProperty('stdoutEncoding')) { - child.stdout.setEncoding(options.stdoutEncoding); + child.stdout && child.stdout.setEncoding(options.stdoutEncoding); } if (options.hasOwnProperty('stderrEncoding')) { - child.stderr.setEncoding(options.stderrEncoding); + child.stderr && child.stderr.setEncoding(options.stderrEncoding); } // node 0.10.x emits error events if the file does not exist child.on("error", function(err) { - child.emit("exit", 127); + child.emit("exit", 127); }); callback(null, { diff --git a/package.json b/package.json index f38f98d7..768082f9 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "c9.ide.language.javascript.tern": "#7aab8b0b6a", "c9.ide.language.javascript.infer": "#cfec494a3c", "c9.ide.language.jsonalyzer": "#c253f093a0", - "c9.ide.collab": "#e9dd74e31e", + "c9.ide.collab": "#3fc640077c", "c9.ide.local": "#a9703b630c", "c9.ide.find": "#6cc6d3379d", "c9.ide.find.infiles": "#72582de3cd", @@ -90,7 +90,7 @@ "c9.ide.help.support": "#6bcfa8ceff", "c9.ide.imgeditor": "#ed89162aa7", "c9.ide.immediate": "#6845a93705", - "c9.ide.installer": "#4830bcd2f5", + "c9.ide.installer": "#3e6f7a72c9", "c9.ide.mount": "#896ebf836e", "c9.ide.navigate": "#055a1f1a80", "c9.ide.newresource": "#f1f0624768", diff --git a/plugins/c9.cli.publish/publish.js b/plugins/c9.cli.publish/publish.js index c978dd00..df55184d 100644 --- a/plugins/c9.cli.publish/publish.js +++ b/plugins/c9.cli.publish/publish.js @@ -197,6 +197,32 @@ define(function(require, exports, module) { /***** Methods *****/ + function spawn(command, options, callback) { + if (options.stdio == null) { + // if verbose, echo stdout + // always echo stderr + options.stdio = [ + "pipe", + verbose ? process.stdout : "ignore", + process.stderr + ]; + } + + proc.spawn(command, options, function(err, child) { + if (err) return callback(err); + + child.on("exit", function(code) { + if (code !== 0) { + var error = new Error("Command failed: " + command); + error.code = code; + return callback(error); + } + + callback(); + }); + }); + } + function stringifyError(err){ return (verbose ? JSON.stringify(err, 4, " ") : (typeof err == "string" ? err : err.message)); } @@ -551,7 +577,7 @@ define(function(require, exports, module) { }, function(next) { if (options.local) - fs.writeFile(cwd + "/__installed__.js", result.code, "utf8", callback); + return fs.writeFile(cwd + "/__installed__.js", result.code, "utf8", callback); next(); }, function(next) { @@ -603,32 +629,19 @@ define(function(require, exports, module) { tarArgs.push("--exclude-from=" + c9ignore); } tarArgs.push("."); - proc.spawn(TAR, { + spawn(TAR, { args: tarArgs, cwd: cwd + "/.c9/.build" - }, function(err, p){ - if (err) return callback(err); + }, function(err){ + if (err) + return callback(new Error("ERROR: Could not package directory")); + + console.log("Built package", json.name + "@" + json.version + + (dryRun ? " at " + zipFilePath : "")); - if (verbose) { - p.stdout.on("data", function(c){ - process.stdout.write(c.toString("utf8")); - }); - p.stderr.on("data", function(c){ - process.stderr.write(c.toString("utf8")); - }); - } + if (dryRun) return callback(); - p.on("exit", function(code){ - if (code !== 0) - return callback(new Error("ERROR: Could not package directory")); - - console.log("Built package", json.name + "@" + json.version + - (dryRun ? " at " + zipFilePath : "")); - - if (dryRun) return callback(); - - upload(); - }); + upload(); }); }); } @@ -748,28 +761,12 @@ define(function(require, exports, module) { if (!createTag) callback(null, json); - proc.spawn("bash", { + spawn("bash", { args: ["-c", SHELLSCRIPT, "--", json.version, normalizePath(packagePath)] }, function(err, p){ - if (err) return callback(err); - - if (verbose) { - p.stdout.on("data", function(c){ - process.stdout.write(c.toString("utf8")); - }); - p.stderr.on("data", function(c){ - process.stderr.write(c.toString("utf8")); - }); - } - - p.on("exit", function(code, stderr, stdout){ - if (code !== 0) - return callback(new Error("ERROR: publish failed with exit code " + code)); - - console.log("Created tag and updated package.json to version", json.version); - - callback(null, json); - }); + if (err) return callback(err); + console.log("Created tag and updated package.json to version", json.version); + callback(null, json); }); } });