# File lib/chef/daemon.rb, line 104
      def save_pid_file
        file = pid_file
        begin
          FileUtils.mkdir_p(File.dirname(file))
        rescue Errno::EACCES => e
          Chef::Application.fatal!("Failed store pid in #{File.dirname(file)}, permission denied: #{e.message}")
        end
      
        begin
          pid = Process.pid.to_s
          File.open(file, "w") { |f| f.write(pid) }
          Chef::Log.debug("Wrote #{pid} to #{file}")
        rescue Errno::EACCES => e
          Chef::Application.fatal!("Couldn't write to pidfile #{file}, permission denied: #{e.message}")
        end
      end