From f8a5e2d1c25de29ed5d1a8425506bb4f1180b01e Mon Sep 17 00:00:00 2001 From: Max Stepanov Date: Mon, 5 Mar 2018 12:53:31 -0500 Subject: [PATCH 1/2] Possibility to set child_process.exec options in iw.scan method --- iw.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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)); } From c044f6bee17820fd3b1166f699f7faf5d99f8100 Mon Sep 17 00:00:00 2001 From: Max Stepanov Date: Mon, 5 Mar 2018 13:08:06 -0500 Subject: [PATCH 2/2] Fixed iw.exec related test failures --- test/iw.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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'); };