Only open a shell if we really need it