adding detached parameter

This will prevent the process from hanging while prompting for a password. Specifically, the process no longer has access to /dev/tty.

http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options