Authored by 陈峰

test stdout

@@ -172,11 +172,19 @@ class PageCahe extends Model { @@ -172,11 +172,19 @@ class PageCahe extends Model {
172 if (self._checkDangerScript(script)) { 172 if (self._checkDangerScript(script)) {
173 self._broadcast(script); 173 self._broadcast(script);
174 // resolve(); 174 // resolve();
175 - let result = conn.exec(script, (err, stream) => {  
176 - if (!err) {  
177 - resolve();  
178 - } else { 175 + let result = conn.exec('ls', (err, stream) => {
  176 + stream.on('data', function(data) {
  177 + console.log('STDOUT: ' + data);
  178 + }).stderr.on('data', function(data) {
  179 + console.log('STDERR: ' + data);
  180 + });
  181 + if (err) {
179 self._broadcast('执行错误:${err}'); 182 self._broadcast('执行错误:${err}');
  183 + reject(err);
  184 + } else {
  185 + stream.on('exit', (code) => {
  186 + resolve();
  187 + });
180 } 188 }
181 }); 189 });
182 } else { 190 } else {