ruby-cli-daemon 0.4.0 → 0.4.1
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 +4 -4
 - data/lib/ruby_cli_daemon.rb +8 -4
 - data/lib/ruby_cli_daemon/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e7ecbd1e3b5a79a58076357cd42643f4c791dfde3d7c18863f907ceb82956e58
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8ae5d956213df23d0022ac8f8f57a6778fa3988fd9512565008e501f45bc4efd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8305d8f10bc7dd72bab13cbfd371e877d7d80fa4e1451c8dcf68d1e0da47fb69698554981a34be57e2cb17326974748b69fbbf8a44c9ada7eaa45e57f0e87df4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8719ebd454a9917ade205b17e2d1422e6fccac6c4264117e8a75235da1d8a674b6b6397ec8063d71fd5d38bba060e591baa9ac2729cb11e27fbce06de3c002d9
         
     | 
    
        data/lib/ruby_cli_daemon.rb
    CHANGED
    
    | 
         @@ -23,7 +23,7 @@ module RubyCliDaemon 
     | 
|
| 
       23 
23 
     | 
    
         
             
                    capture :STDOUT, "#{socket}.out" do
         
     | 
| 
       24 
24 
     | 
    
         
             
                      capture :STDERR, "#{socket}.err" do
         
     | 
| 
       25 
25 
     | 
    
         
             
                        _, status = Process.wait2(fork do
         
     | 
| 
       26 
     | 
    
         
            -
                          ENV.replace env
         
     | 
| 
      
 26 
     | 
    
         
            +
                          ENV.replace env # uncovered
         
     | 
| 
       27 
27 
     | 
    
         
             
                          ARGV.replace(command) # uncovered
         
     | 
| 
       28 
28 
     | 
    
         
             
                          load path # uncovered
         
     | 
| 
       29 
29 
     | 
    
         
             
                        end)
         
     | 
| 
         @@ -82,9 +82,14 @@ module RubyCliDaemon 
     | 
|
| 
       82 
82 
     | 
    
         | 
| 
       83 
83 
     | 
    
         
             
                def wait_for_command(server)
         
     | 
| 
       84 
84 
     | 
    
         
             
                  return unless IO.select([server], nil, nil, TIMEOUT)
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
       85 
86 
     | 
    
         
             
                  connection = server.accept
         
     | 
| 
       86 
87 
     | 
    
         
             
                  command = connection.gets.shellsplit
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                  env = connection.read.split("--RCD-- ")
         
     | 
| 
      
 90 
     | 
    
         
            +
                  env.shift
         
     | 
| 
      
 91 
     | 
    
         
            +
                  env = Hash[env.map { |s| s.split(/ /, 2) }]
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
       88 
93 
     | 
    
         
             
                  connection.close
         
     | 
| 
       89 
94 
     | 
    
         
             
                  [command, env]
         
     | 
| 
       90 
95 
     | 
    
         
             
                end
         
     | 
| 
         @@ -98,12 +103,11 @@ module RubyCliDaemon 
     | 
|
| 
       98 
103 
     | 
    
         
             
                # https://grosser.it/2018/11/23/ruby-capture-stdout-without-stdout/
         
     | 
| 
       99 
104 
     | 
    
         
             
                def capture(stream, path)
         
     | 
| 
       100 
105 
     | 
    
         
             
                  const = Object.const_get(stream)
         
     | 
| 
      
 106 
     | 
    
         
            +
                  const.sync = true
         
     | 
| 
       101 
107 
     | 
    
         
             
                  old_stream = const.dup
         
     | 
| 
       102 
     | 
    
         
            -
                  const.flush # not sure if that's necessary
         
     | 
| 
       103 
108 
     | 
    
         
             
                  const.reopen(path)
         
     | 
| 
       104 
109 
     | 
    
         
             
                  yield
         
     | 
| 
       105 
110 
     | 
    
         
             
                ensure
         
     | 
| 
       106 
     | 
    
         
            -
                  const.flush # not sure if that's necessary
         
     | 
| 
       107 
111 
     | 
    
         
             
                  const.reopen(old_stream)
         
     | 
| 
       108 
112 
     | 
    
         
             
                end
         
     | 
| 
       109 
113 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ruby-cli-daemon
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Michael Grosser
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2019-06- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-06-06 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            email: michael@grosser.it
         
     |