class Gitlab::Shell::History

def history_file

def history_file
  if defined?(@history_file)
    @history_file
  else
    @history_file = File.open(history_file_path, 'w', 0600).tap do |file|
      file.sync = true
    end
  end
rescue Errno::EACCES
  warn 'History not saved; unable to open your history file for writing.'
  @history_file = false
end