Putting this code in a separate library let's services that depend only on the shell be clearer about their dependencies.