[fix] pid should be a string as we assume `%s` in our commands.
[fix] trim whitespace from pid file retrieval.
[fix] added missing `cmd` variable
[test] Added tests for running.