system_utils.rb 554 B

1234567891011121314151617181920212223242526272829303132
  1. class Object
  2. def deep_clone
  3. Marshal::load(Marshal.dump(self))
  4. end
  5. end
  6. class SystemUtils
  7. constructor :system_wrapper
  8. def setup
  9. @tcsh_shell = nil
  10. end
  11. def tcsh_shell?
  12. # once run a single time, return state determined at that execution
  13. return @tcsh_shell if not @tcsh_shell.nil?
  14. result = @system_wrapper.shell_backticks('echo $version')
  15. if ((result[:exit_code] == 0) and (result[:output].strip =~ /^tcsh/))
  16. @tcsh_shell = true
  17. else
  18. @tcsh_shell = false
  19. end
  20. return @tcsh_shell
  21. end
  22. end