Module: Cline::Utils::Os::Linux
- Includes:
- Logger
- Defined in:
- lib/cline/utils/os/linux.rb
Overview
OS utils for host OS linux
Instance Method Summary collapse
-
#cline_exe ⇒ Array<String>
The Cline executable command line (can also have some arguments).
-
#kill(pid) ⇒ Object
Kill a process Handles errors gracefully in case the process has already disappeared.
-
#max_cmd_length ⇒ Integer
Maximum length a command line can have.
-
#user_app_data_dir ⇒ String
The user applications data directory.
-
#user_home_dir ⇒ String
Get the user home directory path.
Methods included from Logger
#log_debug, sanitize_pty_output
Instance Method Details
#cline_exe ⇒ Array<String>
Returns The Cline executable command line (can also have some arguments).
27 28 29 |
# File 'lib/cline/utils/os/linux.rb', line 27 def cline_exe ['cline'] end |
#kill(pid) ⇒ Object
Kill a process Handles errors gracefully in case the process has already disappeared.
19 20 21 22 23 24 |
# File 'lib/cline/utils/os/linux.rb', line 19 def kill(pid) Process.kill('TERM', pid) rescue Errno::ESRCH # Could be that the process naturally died before we interrupted it log_debug "Process #{pid} was already killed" end |
#max_cmd_length ⇒ Integer
Returns Maximum length a command line can have.
37 38 39 |
# File 'lib/cline/utils/os/linux.rb', line 37 def max_cmd_length @max_cmd_length ||= Integer(`getconf ARG_MAX`.strip) end |
#user_app_data_dir ⇒ String
Returns The user applications data directory.
32 33 34 |
# File 'lib/cline/utils/os/linux.rb', line 32 def user_app_data_dir "#{user_home_dir}/.config" end |
#user_home_dir ⇒ String
Get the user home directory path
11 12 13 |
# File 'lib/cline/utils/os/linux.rb', line 11 def user_home_dir @user_home_dir ||= `eval echo ~$USER`.strip end |