Encountering a problem with Version 11

I'm encountering a problem with KM Version 11 with a macro that works fine in KM Version 10. (To test, I've put it the macro on another machine and reverted back to version10.2 It had been failing on that machine until I reverted back to the previous KM version.) I've spent much time trying to figure out what was causing a macro to fail before posting to this list and I've isolated the step that fails in version 11.

Basically, I have macros that are triggered at set times to download files using CURL or WGET in terminal. Some of the macros use terminal commands to subsequently unzip or run other routines.

I have other files that I download on a timed basis too and I have it set everything up so that if a macro takes too long, KM send a "quit application" ( in this case, the app is Terminal) command. Terminal sometimes will give a notification, "Are you sure you want to Terminate running process" if it's running a routine.

running

--> To handle this situation, I have KM perform a "forced quit" on the application (Terminal) if it's still running after a short delay.

"Force Quit" an application is what's failing in version 11. At least as far a Terminal goes. The same macro has worked fine in version 8 9 and 10.

Here's a screen shot of the macro that fails in 11:

I use several Macs for downloading files and even though Peter generously allows people to use one license on 5 machines, I routinely purchase three licenses to support Peter's incredible work. I've done that with version 11 and I'd hate to roll everything back to 10 to get everything working again.

Anyone else encountering this issue?

I should add that Quit Application (in this case Terminal) works if Terminal is running something simple, but where Terminal is 'busy' with a more advance routine, it will display a message confirming if you want to quit and that's where "forced quit" fails in version 11.

BTW, I'm still running Ventura on Intel Macs

I tried it a couple of ways and Terminal always quit for me on Ventura with an M2.

The first activated Terminal, paused until I hit return (I got the message asking if I really wanted to quit) and then quit.

For the second, I activated Terminally manually and ran a single action Quit Terminal macro, which also worked.

I'm wondering if a setting in the gear menu on an action upstream is the root of your issue (maybe not running asynchronously).

In any case, I never had to get to a Force Quit action.

Noted.

Can you make the simplest macro that demonstrates the issue and post the actual macro so I can try to duplicate it.

It'll be in a few days, because I currently have a lot of Terminal windows open and I don't want to force quit it on my Ventura Mac and my other Macs are running different versions of macOS.

Thanks.

1 Like

That gives us a lot of insight into your development environment. Interesting. I hadn't really thought much about how many computers you need. You don't need to reveal any trade secrets, but how many computers do you own in order to develop and support Keyboard Maestro?

I have one primary development Mac which is running Ventura and the previous version of Xcode, since I have no plans to update either of them while I'm in the middle of a major release. I expect I'll update both of them in a few months, maybe early next year.

I have a laptop that has Sonoma on it for testing that.

And I have a server Mac that does things like Backups and such, and I leave that running the minimum version Keyboard Maestro supports so I always test Keyboard Maestro on that each time I do a release.

Then the rest of my family have various Macs that sometimes get roped in to testing all with various different versions of macOS.

4 Likes

Thanks for that information. I'm not a tax man, but if your family spends time helping you, you probably could pay them and deduct their salary as an expense.

Make sure you have a really good offsite backup mechanism. I don't want to lose KM due to loss of files.

No need to reply to this message.

Hi Peter,
I've written directly to you about this issue. I wish I could send a simple macro, but basically, I'm using Terminal to run an essential weather model C-Fortran program called wgrib2. (wgrib2 is used to slice and dice weather model data.) Often the data is gigabytes large and it's during this wgrib2 background process that force quit no longer terminates. I don't think I can provide the giant files to demonstrate and furthermore, wgrib2 has to be compiled on your specific machine; it's not an off the shelf application.

Force Quit worked flawlessly in KM 8 9 and 10 with this. Only you know what changes, if any, were made to KM 11 under the hood.

As I wrote to you earlier, I also run this on an old mac mini running Mojave. My macro's Force quit worked in 10.2 but no longer 11. Rolling it back to 10.2 and things worked again. So I'm pretty sure it's not a Ventura-specific issue.

I'm sure I can figure out some work around if I absolutely need to but I'd love to discover what has changed its behavior in 11.

I have four different backups, one always offsite and one rotated offsite.

1 Like

None for force

My guess based on that is that it's not actually the force quit that is the issue, but something else that seems like it is the force quit.

Hi MrPasini,
First, Thanks for all your contributions to this forum. I find them so useful!

The issue here is when Terminal is controlling a background process that force quit longer works in 11. I've provided more details lower down in this thread. Its not a Ventura issue. My Mojave based macmini is having the same issues. I had to roll it back to 10.2 and things resumed to normal.

1 Like

I'll check that, but no changes were made in the gear settings.

Which explains why my simple test ran without a hitch. I wasn't running a background process.

I suspect that the dialog displayed is a system level dialog to terminate the process, not an application dialog. Nonetheless, Force Quit on Terminal always worked in previous versions.

I tried to have Keyboard Maestro send a keystroke return to the same dialog instead of a force quit. But I knew from previous experience it doesn't work. And it didn't.

running

To see if a true force quit would work, I selected it from the dock with the option key down and it did.

forcequit

So somethings gotta be different where KM 11 is not really sending a force quit to Terminal here as it did in 10.2

Ok, I have a solution to the macro problem but it doesn't explain the changed behavior in KM 11.

The old macro had this fancy footwork- quit Terminal and then if it doesn't quit, do a forced quit.

This worked in Version 10.2 and earlier. It doesn't work in version 11—

Apparently, the condition "This (Terminal) application running" is perhaps not true, but I'm open to a good explanation what's really going on (or what's not).

--> To have it Terminal quit, I'm going to have to always do a force quit to avoid that system dialog box that doesn't respond.

So this works in Version 11—

I'd hate to have to always force quit an application; nothing gets cleaned up and it's not very graceful. But that seems to be the solution for now.

Any ideas about what's changed? Thanks

This could be related to the…

Adjusted Quit Application (et al) actions to wait for the application to terminate (or relaunch).

…change in KM11 (Whats New).


Make sure that the initial Quit action does not abort the macro after timeout.

With that, and the timeout of the Quit action set to something short like 2s, both of the following macros work for me with KM11 (and macOS 13.6):

Terminal Quit Confirmation via Button.kmmacros (4.1 KB)

Terminal Force Quit at Confirmation.kmmacros (3.6 KB)


PS:

The first macro works also with a Keystroke 'Return' action instead of the Press Button action.

1 Like

Ahh, yes, that makes sense.

So basically do

  • Quit (timeout 1 second, do not notify or abort macro)
  • Force Quit (do not notify)

The force quit will do nothing if the quit succeeds, and no pause is needed.

Great catch @Tom !

Peter, Tom,
That solved it! A big thank you!

So I'm going to have to carefully review the "What's New" in 11 to see if I encounter other things.

One thing, that I'm not getting my head around- What's the difference between "Assert that Conditions are met" (Terminal running) verses the conditional "if then" that I used, "If Terminal is still running", do this...

Or was the crux of the problem with the Time Out/Abort Macro behavior on the first command "Quit Application (Terminal)" ?

Ok, I see that the crux was the "Time Out/Abort Macro" (1 second) "gear setting" on the first Quit Application (Terminal) was the real issue and my code works otherwise if I use the conditional.

Thanks so much again, Tom, for figuring this out.

Basically, Assert is a simplified If…Then (it always aborts if the condition is not met, whereas with an If…Then you can choose what you want to do). I just took it for the test macros because it's simpler, it is not related to your issue.

Or was the crux of the problem with the Time Out/Abort Macro behavior on the first command "Quit Application (Terminal)" ?

Yes. When you create a new Quit action, it has these timeout settings by default:

That's not what you want for your use-case, because it stops your macro in the tracks, since the Terminal's confirmation dialog makes the action fail. (I.e., with a confirmation dialog, the action waits for 20s and then aborts the macro. It would work as intended if the Terminal quits without confirmation.)

It works fine for your case if you remove the Abort (and the Notify too) and set the timeout to something short (1 or 2s, for example).

Thanks to the timeout you don't need a pause afterwards and can immediately run the Force Quit.

Tom,
Thanks for clarifying this. Really appreciate it.