sniffnet icon indicating copy to clipboard operation
sniffnet copied to clipboard

Wrapper script is causing problems on macOS

Open itfidele opened this issue 2 years ago • 9 comments

[!NOTE] We found out this issue to be related with the wrapper script that's giving admin privileges to the executable on macOS (needed to inspect a network adapter). This is causing several problems, such as the impossibility to close the app from the dock menu, minimize, and maximize the window.


To Reproduce Describe steps to reproduce the bug, e.g.:

  1. Open sniffnet
  2. Try to exit the app from Doc bar or force exit

Expected behavior To close app and it's all instances

Screenshots Screenshot 2023-05-19 at 14 13 11

Desktop:

  • OS: MacOS

itfidele avatar May 19 '23 11:05 itfidele

Thanks for pointing out, I never noticed it. However, you should be able to comfortably close the app with cmd+Q.

GyulyVGC avatar May 19 '23 11:05 GyulyVGC

After thinking about it I've found a reason for this issue and #198: on macOS the app is launched by a wrapper that gives it admin privileges required to inspect your PC's network adapters (see this file). After having launched the app, the wrapper is quit to not have more than one process running for Sniffnet. The app shown in the dock remains linked to the original process though (the wrapper which has already been quit). I'll work to fix this problem.

GyulyVGC avatar May 19 '23 13:05 GyulyVGC

This is interesting, thanks @GyulyVGC

itfidele avatar May 20 '23 13:05 itfidele

You're welcome!

GyulyVGC avatar May 20 '23 13:05 GyulyVGC

For the same reason, I've discovered that Sniffnet 1.2.0 cannot be set full screen on macOS.

GyulyVGC avatar May 22 '23 09:05 GyulyVGC

It's probably due to running the app in the background:

                                                                                    🡻
do shell script "/Applications/Sniffnet.app/Contents/MacOS/sniffnet >/dev/null 2>&1 &" with administrator privileges

May you please modify your /Applications/Sniffnet.app/Contents/MacOS/wrapper.sh file and test it without the >/dev/null 2>&1 & part?

P.S. We have to discuss our options for getting rid of the Terminal as well as launching the app using the native Window Manager. I might have some ideas... @GyulyVGC

4r7if3x avatar Jun 01 '23 15:06 4r7if3x

The >/dev/null 2>&1 & is exactly the cause, but without including it the app starts in two separated instances and two open Sniffnet icons are shown (one for the script and one for the actual process).

GyulyVGC avatar Jun 01 '23 16:06 GyulyVGC

The >/dev/null 2>&1 & is exactly the cause, but without including it the app starts in two separated instances and two open Sniffnet icons are shown (one for the script and one for the actual process).

It's probably because the app launches itself after being launched by the wrapper script, yet sending one to the background is just sweeping the dirt under the carpet... Using sudo alone should be sufficient, but I'll discuss this further with you via email, we might be able to resolve this another way.

4r7if3x avatar Jun 01 '23 16:06 4r7if3x

I just tried it without >/dev/null 2>&1 & and the issues are still there, unexpectedly.

The behaviour is the same except for the fact that two icons open instead of one.

Using sudo is what I did until the last release, but I didn't like that solution because a terminal was spawned and kept opened.

GyulyVGC avatar Jun 05 '23 09:06 GyulyVGC