Rosettea / Hilbish

🌓 The Moon-powered shell! A comfy and extensible shell for Lua fans! 🌺 ✨
https://rosettea.github.io/Hilbish/
MIT License
496 stars 21 forks source link

feat: allow hilbish exits to be interrupted #298

Open TorchedSammy opened 3 months ago

TorchedSammy commented 3 months ago

if background jobs are being run, the user should be reminded and stopped from exiting the shell. requires #297

simple implementation code:

function hilbish.exit()
    local lingerers = bait.throw 'hilbish.exit'
    if #lingerers == 0 then
        os.exit(0)
    end

    for _, linger in pairs(lingerers)
        print('Woah! Can\'t leave this flower field yet. Reason: %s', linger.reason)
    end
end