Sha256: f19775d47efcd6137daf573243f7e324a0152f52da92d1b719d8a6bcd8691378

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

# encoding: UTF-8

module Tetra
  # runs Bash with tetra-specific options
  class Bash
    include ProcessRunner

    # runs bash in a subshell, returns list of
    # commands that were run in the session
    def bash
      Tempfile.open("tetra-history") do |temp_file|
        temp_path = temp_file.path

        env = {
          "HISTFILE" => temp_path,   # use temporary file for history
          "HISTFILESIZE" => "-1", # don't limit file size
          "HISTSIZE" => "-1", # don't limit history size
          "HISTTIMEFORMAT" => nil, # don't keep timestamps
          "HISTCONTROL" => "", # don't skip any command
          "PS1" => "\e[1;33mdry-running\e[m:\\\w\$ " # change prompt
        }

        run_interactive("bash --norc", env)
        File.read(temp_path).split("\n").map(&:strip)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tetra-0.52.0 lib/tetra/facades/bash.rb