fix publish hanging because of not reading from tar stdout

pull/43/merge
nightwing 2015-05-14 17:18:43 +04:00
rodzic fbe5821d84
commit 6f7184c56b
3 zmienionych plików z 44 dodań i 47 usunięć

6
node_modules/vfs-local/localfs.js wygenerowano vendored
Wyświetl plik

@ -1465,15 +1465,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, {

Wyświetl plik

@ -90,7 +90,7 @@
"c9.ide.help.support": "#60e88f5680",
"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",

Wyświetl plik

@ -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);
});
}
});