I have a simple OnServerStart Interceptor that I’d like to use to print something in the CLI when a server is started:
component { property name="print" inject="print"; function onServerStart( interceptData ) { print.line("hi world"); } }
The interceptor has been registered in my moduleConfig.cfc and I’ve also tried putting the onServerStart function directly in the moduleConfig.cfc. Both give same results.
After reloading or restarting commandBox and then starting a server, I get nothing on my screen. No error. No “hi world” text. I can remove the line where I inject the print utility ( the line with the “property” declaration ) and when I start a server, I get an error saying “print” is not defined. (so I know the my interceptor is firing on server start.)
It seems that I can’t inject other util objects as well, like the FileSystem or the Shell. Shouldn’t I be able to do this and if so,what am I missing in my interceptor to make it work?
version info
CommandBox:pws> version CommandBox 3.3.0+00482 CommandBox:pws> version --loader CLI Loader 1.3.8 CommandBox:pws>
Thanks in advance!
Joel