Skip to content

Commit

Permalink
fix(wifi): ignores initial commands not found error
Browse files Browse the repository at this point in the history
  • Loading branch information
HipsterBrown committed Mar 5, 2016
1 parent c1c0e57 commit ac72ef1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/tessel/wifi.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ Tessel.prototype.getWifiInfo = function() {
network.ips = ipResults.split('\n');
return Promise.resolve(network);
});
})
.catch((err) => {
if (err.toString().includes('Not found')) {
var msg = `${this.name} is not connected to Wi-Fi (run "t2 wifi -l" to see available networks)`;
return Promise.reject(msg);
} else {
return Promise.reject(err);
}
});
};

Expand Down Expand Up @@ -180,7 +188,11 @@ Tessel.prototype.setWiFiState = function(enable) {
}
this.receive(remoteProcess, (err, result) => {
if (err) {
return reject(err);
if (err.toString().includes('Not found')) {
return pollForWifiSignal();
} else {
return reject(err);
}
}
if (result.toString().includes('signal')) {
settle();
Expand Down

0 comments on commit ac72ef1

Please sign in to comment.