fiedl-log 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50633d096202849e748b14cc35cf0badcf887040d719239480c5117dda15d454
4
- data.tar.gz: 83cd6b2bc6aea3834a3ef40a52bd1c19a8f573da7027a64fb8c325aa8ec2e352
3
+ metadata.gz: 8eb4f350bd36e35109a6fc799ba1b4af7e5173c79c13cdbe69277a9b1a36a9dd
4
+ data.tar.gz: 41200374085c40159f3c5c71f25a36af634a38f3304e713440d469c1f7b00261
5
5
  SHA512:
6
- metadata.gz: 298c22019b349406edb0569f75c416e1209c78cd7715fdb635e093d9de61f3e36b48db493ac55427a816150756c51cd7159ad4cf65f63aabd0567bc65556bd2a
7
- data.tar.gz: e36ea52a0268251cebffc7c8b348941e37391f4a884755bb91716e18718ce9bfb0e7bd1d6a39da142e12f91c4463bfc9ecff658cf54edb9114aa4314008c10e6
6
+ metadata.gz: af4d6d196b38eb29e74ca4675b38620b4022c6648a9f3b89a65c78e7525135e0a436aef99c010ebaf559ad93582ba39dc1824d958301fc07fae1ccb132f399c5
7
+ data.tar.gz: 11609ac7033c010650d6a3c2e135d5d50fd0d9768b1c62e45717a51690ea23484bbf0875899505b52371fc55d8b77f29585be553469c899ef348d85228ee4c80
data/lib/fiedl/log/log.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'tempfile'
2
+
1
3
  class Fiedl::Log::Log
2
4
 
3
5
  def head(text)
@@ -55,22 +57,29 @@ class Fiedl::Log::Log
55
57
  super(text)
56
58
  end
57
59
 
58
- # Print commant, execute it and display result.
59
- # See also: http://stackoverflow.com/a/10224650/2066546
60
+ # Print command, execute it and display result.
61
+ # The command may be interactive.
62
+ #
63
+ # https://stackoverflow.com/a/20187740/2066546
64
+ # http://stackoverflow.com/a/10224650/2066546
65
+ # https://stackoverflow.com/q/20072781/2066546
66
+ # https://stackoverflow.com/a/29712307/2066546
60
67
  #
61
68
  def shell(command, verbose: true)
62
69
  prompt command if verbose
63
70
 
64
- output = ""
65
- r, io = IO.pipe
66
- pid = fork do
67
- system(command, out: io, err: io)
68
- end
69
- io.close
70
- r.each_char{|c| (print c if verbose); output += c}
71
+ file = Tempfile.new("fiedl-log")
72
+ @return_code = system "script -q #{file.path} #{command}"
73
+ output = file.read
74
+
75
+ return output
76
+ ensure
77
+ file.close
78
+ file.unlink
79
+ end
71
80
 
72
- Process.waitpid pid
73
- return output.strip
81
+ def return_code
82
+ @return_code
74
83
  end
75
84
 
76
85
  # Ensure that a certain file is present.
@@ -1,5 +1,5 @@
1
1
  module Fiedl
2
2
  module Log
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fiedl-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Fiedlschuster
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-21 00:00:00.000000000 Z
11
+ date: 2022-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,7 +92,7 @@ homepage: https://github.com/fiedl/fiedl-log
92
92
  licenses:
93
93
  - MIT
94
94
  metadata: {}
95
- post_install_message:
95
+ post_install_message:
96
96
  rdoc_options: []
97
97
  require_paths:
98
98
  - lib
@@ -108,8 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.0.3.1
112
- signing_key:
111
+ rubygems_version: 3.3.11
112
+ signing_key:
113
113
  specification_version: 4
114
114
  summary: Simple colored output helper for ruby scripts.
115
115
  test_files: []