socotra-build 0.3.37 → 0.3.43
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/socotra-build.rb +17 -14
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2b74e386b956f6ed30f03fcc8add65ca1b776d04
|
|
4
|
+
data.tar.gz: 0c2bbedc6715d917d67a663c1ec0636259060e74
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d349683f3b3c8f04d00decc5514143780264bc5d7727fc90e33a0552b59480613cfb52564ea4b326c6876f00ab8e71233b2322cd89447b75e78b50832b837e93
|
|
7
|
+
data.tar.gz: 0ffef18a6557022d84c82216ce84731116706d37305ba9a632025b2009b6eb31229f90d4d381c69d43f04317ace194166cdb35eef87020d005688fb91b8fa200
|
data/lib/socotra-build.rb
CHANGED
|
@@ -74,8 +74,23 @@ def self.kill_pid(pid, timeout)
|
|
|
74
74
|
return false
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
+
def self.execute_cmd(cmd, timeout, log_out, log_err)
|
|
78
|
+
pid = spawn(cmd, :out=>log_out, :err=>log_err)
|
|
79
|
+
begin
|
|
80
|
+
return Timeout::timeout(timeout) do
|
|
81
|
+
_, status = Process.wait2(pid)
|
|
82
|
+
return status.success?
|
|
83
|
+
end
|
|
84
|
+
rescue Timeout::Error
|
|
85
|
+
while pid_exists(pid)
|
|
86
|
+
if kill_pid(pid, timeout)
|
|
87
|
+
return false
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
77
93
|
def self.system_safe(cmd=cmd, cmd_description=cmd_description, error_message=error_message, raise_on_fail=true, log_level="ERROR", log=true, print_command=true, retry_exec=false, timeout=0)
|
|
78
|
-
success = true
|
|
79
94
|
start = Time.now.to_i
|
|
80
95
|
|
|
81
96
|
cmd_sanitized = get_sanitized_cmd(cmd)
|
|
@@ -93,19 +108,7 @@ def self.system_safe(cmd=cmd, cmd_description=cmd_description, error_message=err
|
|
|
93
108
|
log_err = "/dev/null"
|
|
94
109
|
end
|
|
95
110
|
|
|
96
|
-
|
|
97
|
-
begin
|
|
98
|
-
Timeout::timeout(timeout) do
|
|
99
|
-
Process.wait(pid)
|
|
100
|
-
end
|
|
101
|
-
rescue Timeout::Error
|
|
102
|
-
while pid_exists(pid)
|
|
103
|
-
if kill_pid(pid, timeout)
|
|
104
|
-
break
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
success = false
|
|
108
|
-
end
|
|
111
|
+
success = execute_cmd(cmd, timeout, log_out, log_err)
|
|
109
112
|
|
|
110
113
|
elapsed = Time.now.to_i - start
|
|
111
114
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: socotra-build
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.43
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Antenesse
|
|
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
40
40
|
version: '0'
|
|
41
41
|
requirements: []
|
|
42
42
|
rubyforge_project:
|
|
43
|
-
rubygems_version: 2.4
|
|
43
|
+
rubygems_version: 2.6.4
|
|
44
44
|
signing_key:
|
|
45
45
|
specification_version: 4
|
|
46
46
|
summary: Build library
|