Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

re-added setting encoding for shell runner #1653

Merged
merged 1 commit into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 4, 2012
  1. @linh81
This page is out of date. Refresh to see the latest.
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
});
};
Something went wrong with that request. Please try again.