CmdLine cmd fails when run via SHELL

  let r   = execute("hdiutil create -volname 'VolumeName' -srcfolder '<app_path>' -ov -format UDZO '<zip_path>'")

this should create a DMG contains the file specifed by app_path (<> are replaced in execute func)

when run from within my app, it creates a “corrupt” DMG
when run via Terminal (copied from app log so syntaxi is identical), it works perfectly

any ideas?

Not seeing anything that jumps out at me. We do the exact same thing in our Xojo and Go apps. The only thing that we do is provide the path to hdiutil in Xojo ( /usr/bin/hdiutil ) but we don’t do that in the Go apps.

It’s probably something simple and stupid. I would create a small POC app. Perhaps your app is changing the contents in <app_path> while hdiutil is running?

You may need the full path to hdiutil here.

E.g. “/usr/bin/hdiutil”

1 Like

not sure what I did, but it now works properly

in Unix/Linux a shell sometimes may lack enviroment/ export variables if startet out of context by any apps, esp. if sandboxed. Therefore always check and use full paths. check logfiles and or redirect messages (> textfile) to check the outputs.

And better use dd for creating images and volumes

1 Like