rbbt-util 5.26.17 → 5.26.18

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
  SHA256:
3
- metadata.gz: 7cd4fb8b55aecafae6989ecaf79447dadbf5266f6adff7a7aac180f60486c12f
4
- data.tar.gz: 74c2f293e4b913c78df2a7497bb7e99b750964a0c065b0f72cead6b544e5be99
3
+ metadata.gz: 32759bf92db4aa80e14f462432b0dfebaa9bde7e4fba648c994382e1d33e7f10
4
+ data.tar.gz: deb3c88c74d37ca13e19b72130fd4e1d48db2d226f17bd53ce0542b3ad3bdb38
5
5
  SHA512:
6
- metadata.gz: 03dde3dd4ed5c7bf62d505e789928f6e259cbe1027ae3c3755d35626ff0d999b0a604599bcf2b0889622e608aec2bbe45f8bf2164a9aaf97924dd95da01a839c
7
- data.tar.gz: f5ca51a17ab7f29f8f77e8de3a7b365199e07550b6408ca76949ccfc27b93a0a6618b8f5c24fdcbea7f1b4bb4a5ec587e9d686801fdafa534b1d065ba8b89263
6
+ metadata.gz: 641c78e8aa7362c117095d42e9205f2a60272f18a2b415a867fdcd2c21549eec8106187359ebbceb385d62546f24d7d8682ebc4e90d309692c15500749c6a6c5
7
+ data.tar.gz: 8766644b5b4b22c3c66fb6f9f9e63c777ef8bf9c115f89dbd12450ea8ef146a5d8485bbd9a0b102d39169be605581c4955f246db01996b20c6f32fbfa20eba1e
@@ -1,6 +1,7 @@
1
1
  module Docker
2
2
  def self.run(image, cmd, options = {})
3
- mounts, job_inputs, directory, pipe = Misc.process_options options, :mounts, :job_inputs, :directory, :pipe
3
+ mounts, job_inputs, directory, pipe, host_user = Misc.process_options options, :mounts, :job_inputs, :directory, :pipe, :host_user
4
+ pipe = false if pipe.nil?
4
5
 
5
6
  if mounts
6
7
  mounts.each{|t,s| FileUtils.mkdir_p s unless File.exist? s}
@@ -10,6 +11,8 @@ module Docker
10
11
  end
11
12
 
12
13
  image_cmd = "-t #{image}"
14
+
15
+ user_cmd = host_user ? "-u $(id -u ${USER}):$(id -g ${USER})" : ""
13
16
 
14
17
  if directory
15
18
  Path.setup(directory) unless Path === directory
@@ -33,12 +36,9 @@ module Docker
33
36
  end
34
37
  end
35
38
  end if job_inputs
36
- cmd = "docker run #{mount_cmd} #{image_cmd} #{cmd}"
37
- if pipe
38
- CMD.cmd(cmd, :log => true, :pipe => true)
39
- else
40
- CMD.cmd_log(cmd, :log => true)
41
- end
39
+
40
+ cmd = "docker run #{mount_cmd} #{user_cmd} #{image_cmd} #{cmd}"
41
+ CMD.cmd_log(cmd, :log => true, :pipe => pipe)
42
42
  else
43
43
  TmpFile.with_file do |tmpfile|
44
44
  Path.setup(tmpfile)
@@ -62,7 +62,8 @@ module Docker
62
62
  end
63
63
  end
64
64
  end if job_inputs
65
- cmd = "docker run #{mount_cmd} #{image_cmd} #{cmd}"
65
+
66
+ cmd = "docker run #{mount_cmd} #{user_cmd} #{image_cmd} #{cmd}"
66
67
  CMD.cmd_log(cmd, :log => true)
67
68
  end
68
69
  end
@@ -194,8 +194,11 @@ module Misc
194
194
  begin
195
195
  sin.write block
196
196
  rescue IOError
197
- Log.error("Tee stream #{i} #{Misc.fingerprint stream} IOError: #{$!.message}");
197
+ Log.error("Tee stream #{i} #{Misc.fingerprint stream} IOError: #{$!.message} (#{Misc.fingerprint sin})");
198
198
  skip[i] = true
199
+ rescue
200
+ Log.error("Tee stream #{i} #{Misc.fingerprint stream} Exception: #{$!.message} (#{Misc.fingerprint sin})");
201
+ raise $!
199
202
  end unless skip[i]
200
203
  end
201
204
  end
@@ -272,7 +272,6 @@ module Open
272
272
  def self.file_open(file, grep, mode = 'r', invert_grep = false)
273
273
  if (dir_sub_path = find_repo_dir(file))
274
274
  if mode.include? 'w'
275
-
276
275
  stream = StringIO.new
277
276
  class << stream
278
277
  attr_accessor :dir_sub_path
@@ -287,6 +286,8 @@ module Open
287
286
  stream = get_stream_from_repo(*dir_sub_path)
288
287
  end
289
288
  else
289
+ Open.mkdir File.dirname(file) if mode.include? 'w'
290
+
290
291
  file = file.find if Path === file
291
292
  stream = File.open(file, mode)
292
293
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.26.17
4
+ version: 5.26.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-06 00:00:00.000000000 Z
11
+ date: 2019-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake