diff --git a/iw.js b/iw.js index 000a825..0cc35d1 100644 --- a/iw.js +++ b/iw.js @@ -179,14 +179,15 @@ function parse_scan(show_hidden, callback) { * @param {function} callback The callback function. */ function scan(options, callback) { - var interface, show_hidden + var interface, show_hidden, exec_options if (typeof options === 'string') { var interface = options; var show_hidden = false; } else { var interface = options.iface; var show_hidden = options.show_hidden || false; + var exec_options = options.exec_options || {}; } - this.exec('iw dev ' + interface + ' scan', parse_scan(show_hidden, callback)); + this.exec('iw dev ' + interface + ' scan', exec_options, parse_scan(show_hidden, callback)); } diff --git a/test/iw.js b/test/iw.js index 77c62c2..21e5a29 100644 --- a/test/iw.js +++ b/test/iw.js @@ -646,7 +646,7 @@ var IW_SCAN_LINUX = "BSS 14:91:82:c7:76:b9(on wlan0)\n" + describe('iw', function() { describe('iw.scan(interface, callback)', function() { it('should scan the specified interface', function(done) { - iw.exec = function(command, callback) { + iw.exec = function(command, exec_options, callback) { should(command).eql('iw dev wlan0 scan'); callback(null, IW_SCAN_LINUX, ''); }; @@ -708,7 +708,7 @@ describe('iw', function() { }) it('should scan the specified interface and show hidden ssid networks', function(done) { - iw.exec = function(command, callback) { + iw.exec = function(command, exec_options, callback) { should(command).eql('iw dev wlan0 scan'); callback(null, IW_SCAN_LINUX, ''); }; @@ -781,7 +781,7 @@ describe('iw', function() { }) it('should scan the specified interface and not show hidden ssid networks', function(done) { - iw.exec = function(command, callback) { + iw.exec = function(command, exec_options, callback) { should(command).eql('iw dev wlan0 scan'); callback(null, IW_SCAN_LINUX, ''); }; @@ -847,7 +847,7 @@ describe('iw', function() { }) it('should handle errors', function(done) { - iw.exec = function(command, callback) { + iw.exec = function(command, exec_options, callback) { callback('error'); };