Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Latest commit

 

History

History
80 lines (68 loc) · 7.19 KB

hs.crash.md

File metadata and controls

80 lines (68 loc) · 7.19 KB

docs » hs.crash


Various features/facilities for developers who are working on Hammerspoon itself, or writing extensions for it. It is extremely unlikely that you should need any part of this extension, in a normal user configuration.

API Overview

API Documentation

Functions

Signature hs.crash.attemptMemoryRelease()
Type Function
Description Attempts to reduce RAM usage of Hammerspoon
Parameters
  • None
Returns
  • None
Notes
  • This function will print some memory usage numbers (in bytes) to the Hammerspoon Console before and after forcing Lua's garbage collector
Signature hs.crash.crash()
Type Function
Description Causes Hammerspoon to immediately crash
Parameters
  • None
Returns
  • None
Notes
  • This is for testing purposes only, you are extremely unlikely to need this in normal Hammerspoon usage
Signature hs.crash.crashKV(key, value)
Type Function
Description Sets a key/value pair in any Sentry crash dump generated by this Hamerspoon session
Parameters
  • key - A string containing the key name of the pair
  • value - A string containing the value of the pair
Returns
  • None
Signature hs.crash.crashLog(logMessage)
Type Function
Description Leaves a breadcrumb log message in any Sentry crash dump generated by this Hammerspoon session
Parameters
  • logMessage - A string containing a message to log
Returns
  • None
Notes
  • This is probably only useful to extension developers. If you are trying to track down a confusing crash, and you have access to the Sentry project for Hammerspoon (or access to someone who has access!), this can be a useful way to leave breadcrumbs from Lua in the crash dump
Signature hs.crash.dumpCLIBS() -> table
Type Function
Description Dumps the contents of Lua's CLIBS registry
Parameters
  • None
Returns
  • A table containing all the paths of C libraries that have been loaded into the Lua runtime
Notes
  • This is probably only useful to extension developers as a useful way of ensuring that you are loading C libraries from the places you expect.
Signature hs.crash.residentSize() -> integer or nil
Type Function
Description Gets the resident size of the Hammerspoon process
Parameters
  • None
Returns
  • An integer containing the amount of RAM in use by Hammerspoon (in bytes), or nil if an error occurred
Signature hs.crash.throwObjCException(name, message)
Type Function
Description Causes Hammerspoon to generate an Objective C exception
Parameters
  • name - A string containing the name of the exception
  • message - A human readabke string explaining the exception
Returns
  • None
Notes
  • Outside of a context of a Lua pcall() (or a C lua_pcall()), this will cause Hammerspoon to exit. We follow the safe behaviour of terminating the app on any unhandled Objective C exception.