lucie-cmd 0.0.16 → 0.0.17

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: cd5df8a70540de02e980855310bef73b6500095a
4
- data.tar.gz: cce6def28c766be78ab7dc62164d655543483d48
3
+ metadata.gz: 5537cb96d16031222139051be054987547495fa2
4
+ data.tar.gz: 45d42fac474693b0dcdcd33c9f9ef2f110a22c86
5
5
  SHA512:
6
- metadata.gz: 53d8a6c6695c34cf7928ecf6c1f63eb9719a6c841a132606ae684e9eac0315d22c8e5fb0457d471b3453559b31811d4aa12b168f4f07785a4a52b39ce853f83c
7
- data.tar.gz: 9452672075121e25f7dd0b73dd0ace3d1036a846320d5776f0e196063ab1f4e6701f1597f11f1f6de4afe58f0490de8bd701fe27cbdb8ad499cf4a05729bee85
6
+ metadata.gz: ea3d0d167e371a8240bad8a5317815e2c853d420782dde1f5496fe4f803b0b622ebf106d58413cbbc038a04f65de458ccfff310c5ef2ba623d8c83bf5371a7fe
7
+ data.tar.gz: 991256bafd7ec65ab0311f3c7b228d45b18dadb6a0d0b189141f22fc61ee4c91e112d5e6d9c5d3208515e6c4e328401b0c8b623f74de2fb06e623d75c8ebc045
@@ -81,15 +81,22 @@ module Lucie
81
81
  end
82
82
 
83
83
  @status = Open4::popen4("cd \"#{pwd}\" && #{command}") do |pid, stdin, stdout, stderr|
84
- @stdin, @stderr, @pid = stdin, stderr, pid
84
+ @pid = pid
85
85
  @output = ""
86
- if !stdout.eof()
86
+ if !stdout.eof
87
87
  new_content = stdout.read
88
88
  if @opts.include? :live_output
89
89
  print new_content
90
90
  end
91
91
  @output << new_content
92
92
  end
93
+ if !stderr.eof
94
+ new_content = stderr.read
95
+ if @opts.include? :live_output
96
+ @stderr.print new_content
97
+ end
98
+ @output << new_content
99
+ end
93
100
  end
94
101
  end
95
102
 
@@ -103,6 +110,9 @@ module Lucie
103
110
 
104
111
  def pwd=(val)
105
112
  @pwd = File.expand_path(val, @pwd)
113
+ if @opts.include? :live_output
114
+ puts "$ cd '#{@pwd}'"
115
+ end
106
116
  end
107
117
 
108
118
  def set(opts = [])
@@ -23,4 +23,12 @@ class CdTest < MiniTest::Spec
23
23
  sh "pwd"
24
24
  assert_equal "/sbin\n", output
25
25
  end
26
+
27
+ it "should log the cd path on console when live_output is on" do
28
+ out, err = capture_io do
29
+ set :live_output
30
+ cd "/tmp"
31
+ end
32
+ assert_equal "$ cd '/tmp'\n", out
33
+ end
26
34
  end
@@ -79,6 +79,14 @@ class ShTest < MiniTest::Spec
79
79
  assert_equal "", out
80
80
  end
81
81
 
82
+ it "should log stderr when live_output is on" do
83
+ _, err = capture_io do
84
+ set :live_output
85
+ sh "echo test 1>&2"
86
+ end
87
+ assert_equal "test\n", err
88
+ end
89
+
82
90
  it "should be able to use green color for output" do
83
91
  out, err = capture_io do
84
92
  green "Hello world"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucie-cmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nucc