This file is indexed.

/usr/share/doc/ruby-systemu/README is in ruby-systemu 2.6.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
NAME

  systemu

SYNOPSIS

  universal capture of stdout and stderr and handling of child process pid for
  windows, *nix, etc.

URIS

  http://github.com/ahoward/systemu
  http://rubyforge.org/projects/codeforpeople/

INSTALL

  gem install systemu

HISTORY
  2.0.0
    - versioning issue.  new gem release.

  1.3.1
    - updates for ruby 1.9.1

  1.3.0
    - move to github

  1.2.0

    - fixed handling of background thread management - needed
      Thread.current.abort_on_exception = true

    - fixed reporting of child pid, it was reported as the parent's pid before

SAMPLES


  <========< samples/a.rb >========>

  ~ > cat samples/a.rb

    #
    # systemu can be used on any platform to return status, stdout, and stderr of
    # any command.  unlike other methods like open3/popen4 there is zero danger of
    # full pipes or threading issues hanging your process or subprocess.
    #
      require 'systemu'
    
      date = %q( ruby -e"  t = Time.now; STDOUT.puts t; STDERR.puts t  " )
    
      status, stdout, stderr = systemu date
      p [ status, stdout, stderr ]

  ~ > ruby samples/a.rb

    [#<Process::Status: pid 50931 exit 0>, "2011-12-11 22:07:30 -0700\n", "2011-12-11 22:07:30 -0700\n"]


  <========< samples/b.rb >========>

  ~ > cat samples/b.rb

    #
    # quite a few keys can be passed to the command to alter it's behaviour.  if
    # either stdout or stderr is supplied those objects should respond_to? '<<'
    # and only status will be returned
    #
      require 'systemu'
    
      date = %q( ruby -e"  t = Time.now; STDOUT.puts t; STDERR.puts t  " )
    
      stdout, stderr = '', ''
      status = systemu date, 'stdout' => stdout, 'stderr' => stderr
      p [ status, stdout, stderr ]

  ~ > ruby samples/b.rb

    [#<Process::Status: pid 50936 exit 0>, "2011-12-11 22:07:30 -0700\n", "2011-12-11 22:07:30 -0700\n"]


  <========< samples/c.rb >========>

  ~ > cat samples/c.rb

    #
    # of course stdin can be supplied too.  synonyms for 'stdin' include '0' and
    # 0.  the other stdio streams have similar shortcuts
    #
      require 'systemu'
    
      cat = %q( ruby -e"  ARGF.each{|line| puts line}  " )
    
      status = systemu cat, 0=>'the stdin for cat', 1=>stdout=''
      puts stdout

  ~ > ruby samples/c.rb

    the stdin for cat


  <========< samples/d.rb >========>

  ~ > cat samples/d.rb

    #
    # the cwd can be supplied
    #
      require 'systemu'
      require 'tmpdir'
    
      pwd = %q( ruby -e"  STDERR.puts Dir.pwd  " )
    
      status = systemu pwd, 2=>(stderr=''), :cwd=>Dir.tmpdir
      puts stderr
    

  ~ > ruby samples/d.rb

    /private/var/folders/sp/nwtflj890qnb6z4b53dqxvlw0000gp/T


  <========< samples/e.rb >========>

  ~ > cat samples/e.rb

    #
    # any environment vars specified are merged into the child's environment
    #
      require 'systemu'
    
      env = %q( ruby -r yaml -e"  puts ENV[ 'answer' ] " )
    
      status = systemu env, 1=>stdout='', 'env'=>{ 'answer' => 0b101010 }
      puts stdout

  ~ > ruby samples/e.rb

    42


  <========< samples/f.rb >========>

  ~ > cat samples/f.rb

    #
    # if a block is specified then it is passed the child pid and run in a
    # background thread.  note that this thread will __not__ be blocked during the
    # execution of the command so it may do useful work such as killing the child
    # if execution time passes a certain threshold
    #
      require 'systemu'
    
      looper = %q( ruby -e" loop{ STDERR.puts Time.now.to_i; sleep 1 } " )
    
      status, stdout, stderr =
        systemu looper do |cid|
          sleep 3
          Process.kill 9, cid
        end
    
      p status
      p stderr

  ~ > ruby samples/f.rb

    #<Process::Status: pid 50956 SIGKILL (signal 9)>
    "1323666451\n1323666452\n1323666453\n"