Safely execute gem commands.