module Munge
  module Cli
    module Commands
      class Server
        def initialize(bootloader)
          @bootloader = bootloader
          @listener   = listener
        end

        def call
          @listener.start

          Dir.chdir(@bootloader.root_path) do
            system("munge view")
          end
        rescue Interrupt => e
          @listener.stop
        end

        private

        def listener
          require "listen"

          Listen.to(@bootloader.root_path) do |modified, added, removed|
            Dir.chdir(@bootloader.root_path) do
              system("munge build")
            end
          end
        end
      end
    end
  end
end

module Munge
  module Cli
    module Commands
      class Server
        def initialize(bootloader)
          @bootloader = bootloader
          @listener   = listener
        end

        def call
          @listener.start

          Dir.chdir(@bootloader.root_path) do
            system("munge view")
          end
        rescue Interrupt => e
          @listener.stop
        end

        private

        def listener
          require "listen"

          Listen.to(@bootloader.root_path) do |modified, added, removed|
            system("munge build")
          end
        end
      end
    end
  end
end

Remove one level of chdir
Remove one level of chdir

Removing the chdir removes a warning about conflicting chdirs
