How long can someone live on a heart-lung machine?

Say someone was suffering lung failure and was waiting for a lung transplant. How long could they survive being sustained by machines?

Do they have devices that function the same as lungs (putting oxygen in the bloodstream, taking carbon dioxide out)? Would it be possible for someone hooked up to that machine to be concious?

Life support systems seem so sophisticated it makes me wonder just how much organ function can be taken over by machine.