sheagcraig / yo

Send Notification Center messages from the command line
Apache License 2.0
384 stars 44 forks source link

Application 'Yo' is not open anymore #6

Closed tulgeywood closed 6 years ago

tulgeywood commented 9 years ago

I have a number of users running into an issue where when they click a button tied to an action they are getting a dialog saying the application 'Yo' isn't open anymore. This is on the most recent release.

sheagcraig commented 9 years ago

Can you give me an example of the invocation you're using?

It's weird because Yo shouldn't be open when they click on it. It delivers the notification and then exits.

tulgeywood commented 9 years ago

I pushed out a policy via JAMF that ran this.

yo -t 'Last call for Fortune survey' -s 'Let your voice be heard!' -a http://i.imgur.com/IxmONtb.gif -b Hippo

tulgeywood commented 9 years ago

I have seen it happen when trying the new Bash function too

sheagcraig commented 9 years ago

And is it 100% of the time that it fails, or just some of the time?

tulgeywood commented 9 years ago

No it is not 100% of the time

sheagcraig commented 9 years ago

Drat. That makes me think it's going to be tougher to figure out.

I'll take a look!

mcfly1976 commented 9 years ago

I get the same message on one of my test machines (5k Retina iMac). It happens all the time when using the action button. I get the message only on this machine. Different other machines (MacBook Air and Pro) are working without any problem.

Edit: Maybe I just found the solution. I created my own version with a custom icon and changed the bundle identifier to com.mycompanyname.yo. But in the code there is used the old bundle identifier for the action button. I think this is the reason for my problem.

if let action = arguments.action.value { notification.userInfo = ["sender": "org.da.yo"]

sheagcraig commented 9 years ago

Oh, nice! Let me look into this.

sheagcraig commented 9 years ago

@mcfly1976 and @tulgeywood Based on @mcfly1976 's comment above, I added some code to detect what has been set in the project's Bundle Identifier and use that in the action button sender calls. Hopefully that will handle at least part of it. Please try the yo testing branch and let me know whether that handles your issues.

I'm not sure what makes this thing hang, honestly. For a lot of early users, it was because they were invoking yo from managed check-ins as managed clients of the Casper Suite, and it was executing despite no console user being logged in, which led to multiple unfinished yo processes hanging.

Using the bash script to launch does avoid that problem.

However, I can't even get it to run on my personal laptop at this point... I fear that continuous tinkering with how to error-proof the whole procedure has led to me jacking up my NotificationCenter database or something (although clearing it didn't seem to help). I can easily build and run on other machines, so I may just have a crazy environment on my laptop at this point. But for the record, what I get is that it says "Posting notification" and then just sits there.

tulgeywood commented 9 years ago

Yea, I ended up with tons of users not ever running polices from my JSS. It took me a long while to realize it was Yo because it was a part of my managed checkins and JAMF doesn't provide very good logging of the checkin process. I will try the testing version of it and see how things go. I've also modified my scrips to only use the invocation script you wrote to be on the safe side. Thanks for continuing the awesome work on this.

groob commented 9 years ago

Just confirming that compiling the testing branch resolved the issue for me.

erikng commented 9 years ago

I'm wondering if this is caused by calling the bash script. I have not seen this issue until today when playing with groob's yo-yo tool.

https://github.com/groob/yo-yo

sheagcraig commented 9 years ago

@erikng So you are having issues with the testing version? Running the bash script? Via yo-yo?

Also @groob That's awesome. I have on my todo list that I wanted to add a process whereby if you run yo and there's no console user, it sets up a LauchAgent to run it at login, and then clean up after itself.

Sounds like you beat me to it. I'd love to include this in the release if you're cool with that. Unfortunately, the school year is starting for us, so it could be awhile before I can get to this, but a PR to the testing branch would get added pretty fast at least. (Merge to master might be a bit).

erikng commented 9 years ago

Oops sorry! I build from the master branch.

I'll try a test tomorrow with yoyo and build one from the testing branch.

If this concept could be merged into Yo, I would be a very happy man.

Sent from my iPhone

On Aug 19, 2015, at 8:31 AM, Shea Craig notifications@github.com wrote:

@erikng So you are having issues with the testing version? Running the bash script? Via yo-yo?

Also @groob That's awesome. I have on my todo list that I wanted to add a process whereby if you run yo and there's no console user, it sets up a LauchAgent to run it at login, and then clean up after itself.

Sounds like you beat me to it. I'd love to include this in the release if you're cool with that. Unfortunately, the school year is starting for us, so it could be awhile before I can get to this, but a PR to the testing branch would get added pretty fast at least. (Merge to master might be a bit).

— Reply to this email directly or view it on GitHub.

sheagcraig commented 8 years ago

Just an update on this: Going to go ahead with the LaunchAgent / watch paths approach (similar to Outset's OnDemand setup) to try to work around the launching issues.

groob commented 8 years ago

Does that mean there will be some sort of artifact like a plist file for each notification?

tulgeywood commented 8 years ago

@groob I believe he means it will create a launchagent if there is no logged in console user only. It will then self destruct after posting the notification.

mbonne commented 7 years ago

Hi Sheagcraig,

Firstly, I'd like to say thanks for all the work and effort put into this project.

I was also getting the error: Application 'Yo' is not open anymore When running the example codes.

Compiled on macOS 10.12.3 with xCode Version 8.2.1 (8C1002) ignoring the warnings about old swift code when building. xCode complains but builds anyway.

Is this project still running? just seeing that the comments are from last year..

*** Using the Testing build worked for me. 10.12.3 - Xcode Version 8.2.1 (8C1002) Custom logo.

sheagcraig commented 7 years ago

Hi @mbonne; I'm slowly working my way around to each project. It's taking a long time!

Thanks for the update on the testing build working.

mbonne commented 7 years ago

On further test, 10.11.6 to 10.12.3 Macs I found the error "Application 'Yo' is not open anymore." goes away if the Mac is rebooted.

sepiemoini commented 6 years ago

Hello all! Still seeing this as well with 10.12.6 and 10.13.1 clients in my testing. Here's the command I am running/executing.

/Library/Application\ Support/JAMF/Addons/yo.app/Contents/MacOS/yo -t "Software Updates" -s "Click 'Update' to run these now." -b "Update" -B "/usr/local/bin/jamf policy -id 136"

screen shot 2018-02-01 at 12 16 34 pm

Has this been resolved, @sheagcraig? If so, what's the fix? Thanks!

irahodges commented 6 years ago

Same here on this error. Notifications are showing up, but action buttons can be intermittent as I get this sometimes: screen shot 2018-04-06 at 10 48 18 am

sheagcraig commented 6 years ago

Anybody following along and experiencing issues, and especially if you're trying to run this from JAMF, please use the yo_scheduler.

If you're sending a notification as root (as most mgmt agents are running as root), amazingly sometimes users do get notifications, but really it's not supposed to work like that. You need to let the yo_scheduler deliver things in the users' context, or you need to execute the notification with launchctl asuser ...

Please give the yo_scheduler a try and open a new issue if you continue to have issues!