captureScreen quits simulator on Mac (M1)

local function doIt()
local screenCap = display.captureScreen()
transition.to(screenCap, {time = 500, onComplete = function() display.remove(screenCap) screenCap = nil end})
end
local pressIt = display.newRect(100, 100, 110, 90)
pressIt:addEventListener(“touch”, doIt)

It may take one or several times to execute function for simulator to quit. In console I am getting “Finished in 6.8s with exit code -11”.

Though on Windows it works fine. I don’t know this is Mac M1 problem or it happens on all Macs. Can someone test it?

Any Mac owners? Just to be sure that there is nothing wrong on my end.

I have a non-M1 mac (2019 Mac Mini) and it happens on that too, though not every time. In fact it can cause my entire Mac to crash, my ‘workaround’ is to just make sure I never try and call screenCapture in the sim.