Skip to content

Commit

Permalink
re-added setting encoding for shell runner
Browse files Browse the repository at this point in the history
  • Loading branch information
linh81 committed Jun 4, 2012
1 parent b494c51 commit cadbdac
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion plugins-server/cloud9.run.shell/shell.js
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
Expand All @@ -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
});
};
Expand Down

0 comments on commit cadbdac

Please sign in to comment.