fixing process kill and passing cwd
adding tests and fixing killing spawned processes