# File lib/pry/helpers/command_helpers.rb, line 100
      def invoke_editor(file, line)
        raise CommandError, "Please set Pry.config.editor or export $EDITOR" unless Pry.config.editor
        if Pry.config.editor.respond_to?(:call)
          editor_invocation = Pry.config.editor.call(file, line)
        else
          editor_invocation = "#{Pry.config.editor} #{start_line_syntax_for_editor(file, line)}"
        end
        return nil unless editor_invocation

        if jruby?
          begin
            require 'spoon'
            pid = Spoon.spawnp(*editor_invocation.split)
            Process.waitpid(pid)
          rescue FFI::NotFoundError
            system(editor_invocation)
          end
        else
          # Note we dont want to use Pry.config.system here as that
          # may be invoked non-interactively (i.e via Open4), whereas we want to
          # ensure the editor is always interactive
          system(editor_invocation) or raise CommandError, "`#{editor_invocation}` gave exit status: #{$?.exitstatus}"
        end
      end