Osascript stopped working on MacOS Mojave

If I try to execute following code in bash
echo ’
tell application “Finder”
tell disk “MyDisk”
update without registering applications
delay 1
end tell
end tell
’ | osascript

“Finder got an error: AppleEvent timed out. (-1712)”
and build fails.

Expected result:
osascript shouldn’t fail

Additional information:

  1. I use osx_image: xcode10.2
  2. I didn’t happen on osx_image: xcode9
  3. Maybe Terminal app needs special authorization like this one
    to get it working. I cannot grant that permission to myself though.