{"action":"created","issue":{"url":"https://api.github.com/repos/tessel/t2-cli/issues/289","labels_url":"https://api.github.com/repos/tessel/t2-cli/issues/289/labels{/name}","comments_url":"https://api.github.com/repos/tessel/t2-cli/issues/289/comments","events_url":"https://api.github.com/repos/tessel/t2-cli/issues/289/events","html_url":"https://github.com/tessel/t2-cli/issues/289","id":105464860,"number":289,"title":"Tessel remote commands: add \"run command and give me all output\" functionality","user":{"login":"MrNice","id":2587335,"avatar_url":"https://avatars.githubusercontent.com/u/2587335?v=3","gravatar_id":"","url":"https://api.github.com/users/MrNice","html_url":"https://github.com/MrNice","followers_url":"https://api.github.com/users/MrNice/followers","following_url":"https://api.github.com/users/MrNice/following{/other_user}","gists_url":"https://api.github.com/users/MrNice/gists{/gist_id}","starred_url":"https://api.github.com/users/MrNice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrNice/subscriptions","organizations_url":"https://api.github.com/users/MrNice/orgs","repos_url":"https://api.github.com/users/MrNice/repos","events_url":"https://api.github.com/users/MrNice/events{/privacy}","received_events_url":"https://api.github.com/users/MrNice/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-08T20:42:08Z","updated_at":"2015-09-14T03:45:10Z","closed_at":null,"body":"## The Problem:\r\nWe can execute arbitrary shell commands over USB and LAN through SSH, but the ssh interface returns an remote process, which has stdout and stderr event emitters.\r\n\r\nThis is great for complicated use cases, but it's a bit of a hassle when you just want to run a command to get its stdout output.\r\n\r\n```js\r\nreturn self.connection.exec(commands.command())\r\n  .then(function(rp) {\r\n    var err = '';\r\n    var result = '';\r\n\r\n    rp.stderr.on('data', function(d) {\r\n      err += d.toString();\r\n    });\r\n    rp.stdout.on('data', function(d) {\r\n      result += d.toString();\r\n    });\r\n\r\n    rp.once('close', function() {\r\n      if (err.length) reject(new Error(err));\r\n      // DO STUFF HERE\r\n    });\r\n  });\r\n```\r\n\r\n## A Solution\r\nIt would be nice to be able to instead write something like\r\n\r\n```js\r\nreturn self.connection.execOnce(commands.command())\r\n  .then(function(result) {\r\n    // DO STUFF HERE\r\n  })\r\n  .catch(function(err) {\r\n    reject(err);\r\n  });\r\n```"},"comment":{"url":"https://api.github.com/repos/tessel/t2-cli/issues/comments/139955700","html_url":"https://github.com/tessel/t2-cli/issues/289#issuecomment-139955700","issue_url":"https://api.github.com/repos/tessel/t2-cli/issues/289","id":139955700,"user":{"login":"wprater","id":10452,"avatar_url":"https://avatars.githubusercontent.com/u/10452?v=3","gravatar_id":"","url":"https://api.github.com/users/wprater","html_url":"https://github.com/wprater","followers_url":"https://api.github.com/users/wprater/followers","following_url":"https://api.github.com/users/wprater/following{/other_user}","gists_url":"https://api.github.com/users/wprater/gists{/gist_id}","starred_url":"https://api.github.com/users/wprater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wprater/subscriptions","organizations_url":"https://api.github.com/users/wprater/orgs","repos_url":"https://api.github.com/users/wprater/repos","events_url":"https://api.github.com/users/wprater/events{/privacy}","received_events_url":"https://api.github.com/users/wprater/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T03:45:10Z","updated_at":"2015-09-14T03:45:10Z","body":"I like this approach as well!"}}