If you want your program to detect when it's being run by chef, here's one way to do that.
sleep 1 while $ENV{PATH} =~ m#chef[^:]+/bin#;
This works because Chef's shell_out
adds Gem.bindir
to PATH
,
which is something like /opt/chefdk/embedded/bin
.
You may want to delete the "sleep", which will make it run faster.
Would I or anyone ever really do this? Chef Inc's management seems determined to test the question, don't they.
RSS
Add a comment