Skip to content

Commit

Permalink
Allows LAN deploys to close the process properly
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyman727 committed Jan 5, 2016
1 parent 55c5132 commit 93b4788
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/lan_connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ LAN.Connection = function(opts) {
}
};

LAN.Connection.prototype.exec = function(command) {
LAN.Connection.prototype.exec = function(command, options) {
var self = this;
return new Promise(function(resolve, reject) {

Expand All @@ -56,8 +56,11 @@ LAN.Connection.prototype.exec = function(command) {
// Turn an array of args into a string to execute over SSH
command = self._processArgsForTransport(command);

// Set default options if none provided
options = options || {};

// Execute the bash command
self.ssh.exec(command, function(err, godStream) {
self.ssh.exec(command, options, function(err, godStream) {
if (err) {
return reject(err);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/tessel/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,9 @@ actions.runScript = function(t, filepath, entryPoint, opts) {

logs.info('Running %s...', opts.slim ? 'bundled project' : entryPoint);
return new Promise(function(resolve) {
return t.connection.exec(commands.runScript(filepath, actualEntryPointName))
return t.connection.exec(commands.runScript(filepath, actualEntryPointName), {
pty: true
})
.then(function(remoteProcess) {

// When the stream closes
Expand Down
5 changes: 4 additions & 1 deletion test/unit/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ exports['Tessel.prototype.deployScript'] = {
},

runScript: function(test) {
test.expect(10);
test.expect(11);
this.exec = sandbox.spy(this.tessel.connection, 'exec');
deployTestCode(this.tessel, test, {
push: false,
single: false
Expand All @@ -197,6 +198,8 @@ exports['Tessel.prototype.deployScript'] = {
test.equal(this.setExecutablePermissions.callCount, 0);
test.equal(this.startPushedScript.callCount, 0);
test.equal(this.end.callCount, 1);
// Ensure that the last call (to run Node) sets pty to true
test.equal(this.exec.lastCall.args[1].pty, true);
test.done();
}.bind(this));
},
Expand Down

0 comments on commit 93b4788

Please sign in to comment.