vx-lib-shell 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 020aba76a4d5fe04f9a0d3556d56b757b7a5efef
4
- data.tar.gz: c7163b8077940795e76641308513ac2842c0f3a1
3
+ metadata.gz: ac1de258197e6487b76d4b881ef6bb96050b8a02
4
+ data.tar.gz: bc0e35943023134797f32e80676d95e4f3bb76a9
5
5
  SHA512:
6
- metadata.gz: b59fa492ebbc85c1e4b9b77d5f3a6ae4ebde83902d63eb71fd0e36c74ea07e4ce97b3f9b1fa8d1f111702e2789b92b84cd7486ece7e41bdef972ee4785f8a656
7
- data.tar.gz: 1a2b464fe6e7494de4cf7639ea66645f3b86d6fae0aef4ea7dd327cfbf284d929130be2f5ce01cca8b8657964fef29b2bd078b20066a27e03933742184cf2c81
6
+ metadata.gz: 7eeaa52a2799bacb5f906d6581b5adbb2842de78c768e1cb1a0bcb928681af1c24036185bd508bbe7ca21e97d14821f554b07570f8c3e53f993637a5d5dd4133
7
+ data.tar.gz: 57edc0a4c994578ca8dc3cc14702087ad0253848c14a5f331dd6828428d4293119f2500a752c811e46250744205df40ac0983c40bdd54c958092d2f4f32dcf6c
@@ -11,15 +11,17 @@ module Vx
11
11
  def exec(*args, &block)
12
12
  options = args.last.is_a?(Hash) ? args.pop : {}
13
13
  command = args.first
14
+ home = options[:home] || "$HOME"
14
15
 
15
16
  select_timeout = options.delete(:pool_interval) || Shell.pool_interval
16
17
  timeout = Shell::Timeout.new options.delete(:timeout)
17
18
  read_timeout = Shell::ReadTimeout.new options.delete(:read_timeout)
18
19
 
20
+ prefix = "/usr/bin/env - TERM=ansi USER=$USER HOME=#{home} SHELL=/bin/bash /bin/bash -l"
19
21
  if command
20
- command = "/bin/bash -l -c #{Shellwords.escape command}"
22
+ command = "#{prefix} -c #{Shellwords.escape command}"
21
23
  else
22
- command = "/bin/bash -l"
24
+ command = prefix
23
25
  end
24
26
 
25
27
  status = spawn_command_internal(command, options) do |r|
@@ -16,15 +16,17 @@ module Vx
16
16
  def exec(*args, &block)
17
17
  options = args.last.is_a?(Hash) ? args.pop : {}
18
18
  command = args.first
19
+ home = options[:home] || "$HOME"
19
20
 
20
21
  exit_code = nil
21
22
  timeout = Shell::Timeout.new options.delete(:timeout)
22
23
  read_timeout = Shell::ReadTimeout.new options.delete(:read_timeout)
23
24
 
25
+ prefix = "/usr/bin/env - TERM=ansi USER=$USER HOME=#{home} SHELL=/bin/bash /bin/bash -l"
24
26
  if command
25
- command = "/bin/bash -l -c #{Shellwords.escape command}"
27
+ command = "#{prefix} -c #{Shellwords.escape command}"
26
28
  else
27
- command = "/bin/bash -l"
29
+ command = prefix
28
30
  end
29
31
 
30
32
  channel = spawn_channel command, read_timeout, options, &block
@@ -1,7 +1,7 @@
1
1
  module Vx
2
2
  module Lib
3
3
  module Shell
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
6
6
  end
7
7
  end
data/spec/lib/ssh_spec.rb CHANGED
@@ -21,9 +21,9 @@ describe Vx::Lib::Shell::SSH, ssh: true do
21
21
  )
22
22
  end
23
23
 
24
- it "run command successfuly with pty" do
25
- code = run_ssh 'env'
26
- expect(collected).to match(/SSH_TTY=/)
24
+ it "run command successfuly" do
25
+ code = run_ssh 'echo $HOME'
26
+ expect(collected).to match(/\/home\//)
27
27
  expect(code).to eq 0
28
28
  end
29
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vx-lib-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky