Page 1 of 1

Strange return from command EXT

Posted: Sun Dec 27, 2020 6:25 pm
by ostapvoip
Hi,

This code always returns retcopy=0 https://i.imgur.com/t0RqnlM.png

sub main()
// ext ("SET OPTION QUIET 1")
printl ("copy file ^"C:\tools\tetris.exe^" ^"C:\tools\tetris2.exe^" -yq")
retcopy = ext ("copy file ^"C:\tools\tetris.exe^" ^"C:\tools\tetris2.exe^" -yq")
printl (retcopy)
// ext ("SET OPTION QUIET 0")
end sub

Re: Strange return from command EXT

Posted: Mon Dec 28, 2020 3:43 pm
by Eric
Well, yes, if the source does not exist, it cannot copy, and thus, there is no failure in the copy process. The point is that there may be situations where you want it to return an error, and others where you want it to return a success (because you only want to trap real failure). In the first case, you can add a findfirst() code before copying to ensure the file exists.
That's the same with the "del file" command: if the file to delete does not exist, it also return a success...

Re: Strange return from command EXT

Posted: Tue Dec 29, 2020 12:23 am
by ostapvoip
Hmm..
This is a bit out of the box.
But as an option it has the right to life. For some reason, such options are not considered in the documentation.
There are even no return options (and they certainly are).
It would be nice to include code examples there.