This might be adequate:
tee tmpout | ssh localhost
(replace ssh localhost with your own command)
In this example the drawback is that ssh checks whether stdin is coming from a terminal, notices that it isn't, and so doesn't print the prompt as usual. You can still run ls, cd etc and see the output, it's just that you won't have a prompt. If your program doesn't try to be smart the above will probably be a tolerable solution.
If that is no good then the nexty best option is to customise your program - doing so should be fairly straightforward. That failing I'd go with customising bash. I'd be happy to help with the last.