Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support fine-grained KeepAlive control? #7

Open
rami3l opened this issue Jul 9, 2023 · 2 comments
Open

[Feature Request] Support fine-grained KeepAlive control? #7

rami3l opened this issue Jul 9, 2023 · 2 comments

Comments

@rami3l
Copy link

rami3l commented Jul 9, 2023

Thanks a lot for making this wonderful library!

LaunchAgent.keepAlive in its current form can only accept a Bool, but I have encountered the following case where a simple true is not enough since I have to distinguish between zero and non-zero exit codes (a very well-written rationale can be found at https://github.com/tjluoma/launchd-keepalive#launchd-keepalive).

In short, this KeepAlive field has to look like this if I want to follow the best practice:

<key>KeepAlive</key>
  <dict>
    <key>SuccessfulExit</key>
      <false/>
    <key>Crashed</key>
      <true/>
  </dict>

Is it possible to use an enum or something for the type of this field? I'm not that familiar with Swift, but if it is a minor change, maybe I can do something about it... 🙏

@rami3l
Copy link
Author

rami3l commented Jul 9, 2023

Those are the keys supported by KeepAlive as per https://keith.github.io/xcode-man-pages/launchd.plist.5.html#KeepAlive:

  1. SuccessfulExit <boolean>
  2. NetworkState <boolean> (deprecated)
  3. PathState <dictionary of booleans>
  4. OtherJobEnabled <dictionary of booleans>
  5. Crashed <boolean>

... and I guess the most popular keys are the boolean ones.

@emorydunn
Copy link
Owner

It should be possible to support the extended KeepAlive options. It looks like there are a bunch of nested options that will need to be modeled so they're both Swift-y and encode into a valid plist. If you'd like to take a swing at it feel free, I'll also see what I can come up with as I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants