Ok, i'm not a guru in InterProcessCommunication nor i know what a Jenkins jobs is.. but i have some hint for you:
- capture2 is a method provided by Net::SSH. It must have some sort of buffering: 'cause of this is not sufficient to autoflush buffer in your main program, i think yous should try to do in the wrapped, remote program.
- capture2 and many other methods are shorcut around open_ex: look carefully at what docs says about this method. Also probably they all rely on dup(2) or pipe(2).
- if i understand $stdout, $errput are filehandle: if so you can set autoflush for them (if they are regular IO::Handle). Maybe is worth to read also IPC::Open2 to verify that your open2 can support same features (>&FH).
- do not use printf whilst a simple print is sufficient
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.