Hello ,
I have developed a Linux application using Flutter. In this app I am running a shell script from a button click. It is working fine when run via Android studio but its not working from snap file installation. your help is much appreciated.
The script is regarding opening Cashdrawer.
gnome-terminal --window – bash -c /home/arindam/Documents/cashdraweropen.sh
ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: ShellException(gnome-terminal --window – bash -c “/home/arindam/Documents/cashdraweropen.sh Bar Printer”, error: ProcessException: No such file or directory
Command: gnome-terminal --window – bash -c /home/arindam/Documents/cashdraweropen.sh Bar Printer, workingDirectory: /home/arindam/StudioProjects/pos_flutter)
Your snap is strictly confined, which means that it cannot access /usr/bin.
Gnome Terminal happens to live in /usr/bin, which means that your app has absolutely no idea that it exists, hence the error.
You can fix this easily by shipping a copy of gnome-terminal in your $SNAP directory, though be careful, you’ll have to find out which dependenices it calls, and ship a copy of them too.
Here’s a snapcraft.yaml parts example which will ship gnome-terminal. Once you run with this, you might see some error messages mentioning gnome-terminal dependencies which can’t be found, just add a new line to the override-build saying cp /usr/bin/[DEP NAME] $SNAPCRAFT_PART_INSTALL/cargo.