Skip to content

Commit

Permalink
followup: t2 run: hook up process.stdin to remote.stdin
Browse files Browse the repository at this point in the history
Signed-off-by: Rick Waldron <[email protected]>
  • Loading branch information
rwaldron committed Jun 14, 2016
1 parent cb710fe commit c37ff9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/tessel/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ exportables.run = function(tessel, opts) {

// Pipe input TO the remote process.
process.stdin.pipe(remoteProcess.stdin);
process.stdin.setRawMode(true);

// Pipe output FROM the remote process.
remoteProcess.stdout.pipe(process.stdout);
Expand Down
6 changes: 5 additions & 1 deletion test/unit/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,20 +524,24 @@ exports['deploy.run'] = {
},

runStdInOut: function(test) {
test.expect(1);
test.expect(4);

this.exec = sandbox.stub(this.tessel.connection, 'exec', (command, options, callback) => {
callback(null, this.tessel._rps);
this.tessel._rps.emit('close');
});

this.stdinPipe = sandbox.stub(process.stdin, 'pipe');
this.stdinSetRawMode = sandbox.stub(process.stdin, 'setRawMode');

deploy.run(this.tessel, {
resolvedEntryPoint: 'foo',
lang: deployment.js,
}).then(() => {
test.equal(this.stdinPipe.callCount, 1);
test.equal(this.stdinPipe.lastCall.args[0], this.tessel._rps.stdin);
test.equal(this.stdinSetRawMode.callCount, 1);
test.equal(this.stdinSetRawMode.lastCall.args[0], true);
test.done();
});
},
Expand Down

0 comments on commit c37ff9d

Please sign in to comment.