Notes
- Gracefully closing a process ensures that resources are properly cleaned up and data integrity is maintained.
- The side note is a more slow termination
Process:close() method
Try a gracefull process termination.
Return value
This method returns aboolean
value indicating if the operation succeeded.
Example
local sysutils = require "sysutils"
local ui = require "ui"
-- create a process launching Wordpad
local p = sysutils.Process("notepad.exe")
-- start the process
p:spawn()
-- wait 5sec
sleep(5000)
if p:close() then
ui.info("Notepad process has been aborted")
end