mithlond
06/08/2022, 2:25 PMmagick "c:/code/temp/sourcePic.png" "c:/code/temp/destPic.jpg"
and my cf code for it is:
cfexecute(
name="#pathToIM#",
timeout="60",
arguments='"/temp/sourcePic.png" "/temp/destPic.jpg"',
variable="result",
errorVariable="error"
)
writedump({
result: result,
error: error
});
Dave Merrill
06/08/2022, 2:28 PMmithlond
06/08/2022, 2:30 PMMatt Jones
06/08/2022, 3:18 PMcfexecute( name='convert', arguments='"#fileIn#" #arrayToList(argsIn, " ")# "#fileOut#"', variable="Results", errorVariable="Error", timeout="60");
I think whenever I install on local windows, I install something from their optional list like 'extra convert utilities'', our servers are all linux (not sure how they were installed), this call works for both. I do catch errors when it fails. my fileIn/fileOut are always full path.mithlond
06/08/2022, 3:29 PM- c:/code/temp:/app/temp
. My pathToIM
is "/temp/ImageMagick/magick.exe"
and it runs w/o erroring, but if I were to try giving it "/app/temp/ImageMagick/magick.exe"
then it says "no such file or directory", so I'm thinking the /temp
based paths are correct for the input/output images. I'm not very docker savvy though, so 🤷♂️mithlond
06/08/2022, 3:31 PMname
, it errors. If I run the same command on the command line directly and provide a bad path for the source image, it errors. But if I provide a good name
and a bad source image path with cfexecute, it just runs w/o erroring, returns empty string for variable and errorVariable, and w/o producing any output filemithlond
06/08/2022, 4:11 PMtype nul > test.txt
in it and put it in a docker-mapped directory. Running that via the command line creates the test.txt file in the same folder as the .bat file. However!... running the exact same .bat file via cfexecute produces the test.txt file in the web root directory! (probably because that's the context that cfexecute runs the command from.mithlond
06/08/2022, 4:12 PMname
attribute is must be in terms of the docker file system), but that when it executes that command that any files it is working with must be thought of in terms of the context that CF itself is running in, which is the web root.mithlond
06/08/2022, 4:12 PMmithlond
06/08/2022, 4:12 PMmithlond
06/08/2022, 4:12 PMAdam Cameron
cd c:\temp
c:\bin\createFileInWorkdingDir.exe makeme.txt
You'd expect makeme.txt
to be created in c:\temp
, right?
The location of the executable (which is what you're giving <cfexecute>
) bears no relation on the directory it will use to work in. The issue is that CF doesn't allow you to tell it which directory to work in (Lucee does, btw).
CF's docs should be updated to say this though. Ping @saghoshAdam Cameron
Running that via the command line creates the test.txt file in the same folder as the .bat file.I would expect the file to be created in your current directory, not the directory the batch file is in.
Adam Cameron
C:\temp>copy con c:\bin\createFile.bat
type nul > test.txt
^Z
1 file(s) copied.
C:\temp>type c:\bin\createFile.bat
type nul > test.txt
C:\temp>dir
Volume in drive C is OS
Volume Serial Number is 7AB5-679F
Directory of C:\temp
08/06/2022 19:25 <DIR> .
0 File(s) 0 bytes
1 Dir(s) 835,448,934,400 bytes free
C:\temp>c:\bin\createFile.bat
C:\temp>type nul 1>test.txt
C:\temp>dir
Volume in drive C is OS
Volume Serial Number is 7AB5-679F
Directory of C:\temp
08/06/2022 19:26 <DIR> .
08/06/2022 19:26 0 test.txt
1 File(s) 0 bytes
1 Dir(s) 835,448,999,936 bytes free
C:\temp>