Closed MareoRaft closed 10 years ago
I don't think it's possible with Capture::Tiny -- at least not that way. In similar situations, I try to assemble all my commands into a single file up front and execute that file through the shell and capture the result.
Otherwise, you might need to use the shell itself to direct or tee output to a file and then read that back (or tail it).
I'm going to close this ticket since I think what you're doing is outside the scope of Capture::Tiny, but feel free to comment back here if you come up with something clever worth sharing.
I am using shell handles to keep track of '/bin/bash' commands, like so:
open( my $sh_handle, '|-', '/bin/bash' ); now when the user wants to execute something, i do: print $sh_handle "$command";
I tried using your capture function around that statement to get the output, but it seems the shell handle prevents it from working.
What is the best way to do this? It is a requirement that all my commands run in the same shell corresponding to $sh_handle. Thanks!