Search code examples
groovymulesoft

Mulesoft Groovy script permission denied when reading a script file


I have created a flow in Anypoint studio. I want to execute a shell script I have saved. I am using an execute script component with Groovy. My Groovy code looks like this:

cmd = '${mule.home}'
"$cmd/apps/script_test/script.sh".execute().text

I have confirmed that the file is there however I keep getting access denied error whenever I run this:

 java.io.IOException: Cannot run program "/Applications/AnypointStudio.app/Contents/Eclipse/plugins/org.mule.tooling.server.4.3.0.ee_7.3.5.202104131253/mule/apps/script_test/script.sh": error=13, Permission denied

I have tried changing the file's permissions, even set it to 777 but I still am getting this error. Any ideas how I can get this to run?


Solution

  • You have to run .sh using sh , bash , or some other shell.

    This should work

    "sh .../script.sh".execute().text