Handle sudo max response outliving remote output

for #311