keithrbennett / wifiwand

A command line tool to manage wifi, including an interactive shell (currently Mac only)
Apache License 2.0
66 stars 6 forks source link

Error "Wifi could not be disabled" on command `wifi-wand off`... while the command is working! #23

Closed arnlen closed 5 months ago

arnlen commented 5 months ago

When running the command wifi-wand off, the wifi is properly turned off. However, an error is raised:

Error: /Users/me/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/wifi-wand-2.15.0/lib/wifi-wand/models/mac_os_model.rb:209:in `wifi_off'
/Users/me/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/wifi-wand-2.15.0/lib/wifi-wand/command_line_interface.rb:377:in `cmd_of'
/Users/me/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/wifi-wand-2.15.0/lib/wifi-wand/command_line_interface.rb:479:in `block in commands'
/Users/me/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/wifi-wand-2.15.0/lib/wifi-wand/command_line_interface.rb:207:in `attempt_command_action'
/Users/me/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/wifi-wand-2.15.0/lib/wifi-wand/command_line_interface.rb:232:in `process_command_line'
/Users/me/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/wifi-wand-2.15.0/lib/wifi-wand/command_line_interface.rb:519:in `call'
/Users/me/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/wifi-wand-2.15.0/lib/wifi-wand/main.rb:65:in `call'
/Users/me/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/wifi-wand-2.15.0/exe/wifi-wand:5:in `<top (required)>'
/Users/me/.rbenv/versions/3.3.0/bin/wifi-wand:25:in `load'
/Users/me/.rbenv/versions/3.3.0/bin/wifi-wand:25:in `<main>'

Wifi could not be disabled.

To reproduce

Just run:

$ wifi-wand off

Configuration


Thank you for this great gem! 🙌

keithrbennett commented 5 months ago

This was due to the wifi_on? method not working properly due to the airport deprecation.

I have fixed that method to use networksetup instead, and that fixes the problem.

Please gem install wifi-wand and get version 2.16.0, which fixes this and some other issues.