Recently, I whined about a technical problem I was having, where the ampersand from a Perforce trigger wasn't pushing the script it called into the background, which meant that the user was experience a slight delay (a shudder, if you will) when committing changes.
After a little conversation with the Perforce forum, I think I've got a working Ruby workaround. There's also an article about doing this with C, but I wanted to use Ruby.
Have the p4 trigger call a Ruby wrapper script to fork the process. I know I said I tried this, but what I learned was that Perforce is hanging onto the output pipes, so you have to break them first. You do that, and the process forks easily and the user no longer notices the script running. This is only useful, of course, for running this when you don't need the outcome to affect the commit.
$stdout.close $stderr.close Kernel.exec "/usr/bin/ruby /home/abbot/triggers/sleep.rb"
In the p4 trigger file, it's calling the test.rb script with a -W0 flag so that warnings don't kill it, but otherwise it is straightforward now. And I feel much better.