Hi everyone - I have a shell script that automatically runs an R script who's output is several RMD files, a CSV, an HTML file, and a screenshot of the rendered HTML file.
The R script uses the webshot2 package to open the HTML file in a headless chromium browser and capture the rendered output. When I run the shell file from the terminal everything works fine - but when I run it through KM everything works except that the screenshot file never appears.
Is there some KM permission item that I am missing? I am having trouble figuring out why I am getting this behavior.
Edit: I am not getting any errors when this runs...just not the desired output.
Tricky to tell without seeing the macro, but 99% of the time an "it works in Terminal but not in a KM 'Execute Shell Script' action" is because the $PATH environment variable is not the same in each (unless you change it yourself).
Simple fix -- use explicit paths. Run which webshot2 in Terminal and use the output in place of webshot2 in your KM shell script.
The Shell script only calls the R script and the paths are all read from the R environment, or explicitly stated in the R script. When executed by KM the R script has no issues with the path to anything else (other files, package dependencies, functions, etc...) it is only for the webshot2 command.
Here is what is in my shell script: