Browse files

Merge pull request #1653 from ajaxorg/fix_broken_project_zip

re-added setting encoding for shell runner
  • Loading branch information...
2 parents b494c51 + cadbdac commit 10682818c813885b6573c4427f76ec247ebe13ad @zefhemel zefhemel committed Jun 4, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 plugins-server/cloud9.run.shell/shell.js
View
12 plugins-server/cloud9.run.shell/shell.js
@@ -53,6 +53,11 @@ var Runner = exports.Runner = function(options, callback) {
this.runOptions.env = this.env;
+ this.encoding = options.encoding || "utf8";
+ if (this.encoding === "binary") {
+ this.encoding = null;
+ }
+
this.eventEmitter = options.eventEmitter;
this.eventName = options.eventName;
@@ -132,6 +137,11 @@ var Runner = exports.Runner = function(options, callback) {
child.stdout.on("data", sender("stdout"));
child.stderr.on("data", sender("stderr"));
+ if (self.encoding) {
+ child.stdout.setEncoding(self.encoding);
+ child.stderr.setEncoding(self.encoding);
+ }
+
function emit(msg) {
self.eventEmitter.emit(self.eventName, msg);
}
@@ -142,7 +152,7 @@ var Runner = exports.Runner = function(options, callback) {
"type": self.name + "-data",
"pid": pid,
"stream": stream,
- "data": data.toString("utf8"),
+ "data": data,
"extra": self.extra
});
};

0 comments on commit 1068281

Please sign in to comment.