This adds two precautions to avoid future crashes:
Process.launch() can throw ObjC exceptions and those are now bridged to Swift and handled. Process.launch() is deprecated on macOS 14 or newer. So I added a Process extension that automatically uses the right method and provides exception handling in all cases.
The WakaTime state variables lastFile and lastTime are currently being read and written on a single worker thread and strictly don't require any thread safety guarantees for the time being. However, devs could break this in the future by accessing lastFile or lastTime on a separate thread concurrently. This has a potential to cause crashes, especially with concurrent writes. So I added an Atomic property wrapper that makes those two properties atomic.
Fixes #75
This adds two precautions to avoid future crashes:
Process.launch()
can throw ObjC exceptions and those are now bridged to Swift and handled.Process.launch()
is deprecated on macOS 14 or newer. So I added aProcess
extension that automatically uses the right method and provides exception handling in all cases.WakaTime
state variableslastFile
andlastTime
are currently being read and written on a single worker thread and strictly don't require any thread safety guarantees for the time being. However, devs could break this in the future by accessinglastFile
orlastTime
on a separate thread concurrently. This has a potential to cause crashes, especially with concurrent writes. So I added anAtomic
property wrapper that makes those two properties atomic.