moved fork code to spawn_command