bake-toolkit 2.37.0 → 2.37.1

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
  SHA1:
3
- metadata.gz: 10b5d02b50a49b9fe736175a016c46db97ae6e02
4
- data.tar.gz: 32adc905319f5e567b4571fff3e0d22315cdecee
3
+ metadata.gz: 4231ba10a8dbc7711dac892e7b932faf30050404
4
+ data.tar.gz: 4cf03457745cf2bfe3521db89d7847607e160820
5
5
  SHA512:
6
- metadata.gz: 16a1135b69cb94a02c4e15f8c3bb31d36f2ae293872ae3834a1d7dc3e6427cad1c1a2106840bf102db4113a305852002be8ef30ca9db62b4d344408a4b4d1946
7
- data.tar.gz: ef5156a0c490148bab91dd25d14ef687b1a59c0b0c7ee210602c7c8592a817eb74ae6bb0c16aea01cef94e14e439935f747b7ae0161aa55258ed2bf030831f04
6
+ metadata.gz: b900fde5e96ff7eadb477bf6856bcd45a4eb4c2c57aa2399b95eaa6060a19dbb53af56ec8bd6ea05b53521662681fb5eabe6d87b04d7efa90e12ec678ec03280
7
+ data.tar.gz: a572d8d68f5cd1761db7f46af0222cdc3412fd73ee4d4284d21df66ad422394184313964c1dddaf4a7e32b897e9778dd33fbe5a5c4127c7aa4311d1af6220452
@@ -42,12 +42,15 @@ def self.executeQacli(cmd, adminStepAndImmediateOutput = false)
42
42
  qacDaemonError = false
43
43
  consoleOutput = ""
44
44
  success = false
45
+ processTimeout = false
45
46
 
46
47
  loop do
47
48
  FileUtils.rm_rf @options.qacdata if adminStepAndImmediateOutput
48
- success, consoleOutput = ProcessHelper.run(cmd, adminStepAndImmediateOutput)
49
+ # admin step should not take longer than 30 seconds
50
+ success, consoleOutput = ProcessHelper.run(cmd, adminStepAndImmediateOutput, true, nil, [0], Dir.pwd, adminStepAndImmediateOutput ? 60 : 0)
49
51
  licenseError = false
50
52
  qacDaemonError = false
53
+ processTimeout = false
51
54
 
52
55
  consoleOutput.each_line do |line|
53
56
  if (line.include?("License Refused") && !line.include?("License Refused: C:"))
@@ -60,14 +63,19 @@ def self.executeQacli(cmd, adminStepAndImmediateOutput = false)
60
63
  puts "Unable to connect to QAX Daemon!"
61
64
  break
62
65
  end
66
+ if (line.include?("Process timeout"))
67
+ puts "Process takes too long!"
68
+ processTimeout = true
69
+ break
70
+ end
63
71
  end
64
72
 
65
73
  cSizeCheck = checkCipSize()
66
74
 
67
- break unless ((@options.qacretry >= (Time.now - timeStart)) && (!cSizeCheck || licenseError || qacDaemonError))
75
+ break unless ((@options.qacretry >= (Time.now - timeStart)) && (!cSizeCheck || licenseError || qacDaemonError || processTimeout))
68
76
  puts "Retry seconds left: %d" % (@options.qacretry - (Time.now - timeStart))
69
77
  end
70
- checkError = !cSizeCheck || licenseError || qacDaemonError
78
+ checkError = !cSizeCheck || licenseError || qacDaemonError || processTimeout
71
79
  if @options.qacretry > 0 && checkError
72
80
  puts "Retry timeout over: %d -> failure." % (@options.qacretry - (Time.now - timeStart))
73
81
  end
@@ -1,10 +1,12 @@
1
+ require 'timeout'
2
+
1
3
  module Bake
2
4
 
3
5
  class ProcessHelper
4
6
  @@pid = nil
5
7
  @@rd = nil
6
8
 
7
- def self.run(cmdLineArray, immediateOutput=false, force=true, outpipe=nil, exitCodeArray = [0], dir = Dir.pwd)
9
+ def self.run(cmdLineArray, immediateOutput=false, force=true, outpipe=nil, exitCodeArray = [0], dir = Dir.pwd, timeout = 0)
8
10
  rd, wr = IO.pipe
9
11
  @@rd = force ? rd : nil
10
12
  duppedCmdLineArray = cmdLineArray.dup
@@ -18,16 +20,27 @@ module Bake
18
20
  wr.close
19
21
  output = ""
20
22
  begin
21
- while not rd.eof?
22
- tmp = rd.read(1)
23
- if (tmp != nil)
24
- tmp.encode!('UTF-8', :invalid => :replace, :undef => :replace, :replace => '')
25
- tmp.encode!('binary', :invalid => :replace, :undef => :replace, :replace => '')
26
- output << tmp
23
+ begin
24
+ Timeout::timeout(timeout) {
25
+ while not rd.eof?
26
+ tmp = rd.read(1)
27
+ if (tmp != nil)
28
+ tmp.encode!('UTF-8', :invalid => :replace, :undef => :replace, :replace => '')
29
+ tmp.encode!('binary', :invalid => :replace, :undef => :replace, :replace => '')
30
+ output << tmp
27
31
 
28
- print tmp if immediateOutput
32
+ print tmp if immediateOutput
33
+ end
29
34
  end
35
+ }
36
+ rescue Timeout::Error
37
+ @@rd = rd
38
+ @@pid = pid
39
+ ProcessHelper::killProcess(true)
40
+ output << "Process timeout (#{timeout} seconds).\n"
41
+ return [false, output]
30
42
  end
43
+
31
44
  rescue
32
45
  # Seems to be a bug in ruby: sometimes there is a bad file descriptor on Windows instead of eof, which causes
33
46
  # an exception on read(). However, this happens not before everything is read, so there is no practical difference
@@ -40,6 +53,7 @@ module Bake
40
53
  rescue
41
54
  end
42
55
  pid, status = Process.wait2(pid)
56
+
43
57
  @@pid = nil
44
58
  @@rd = nil
45
59
 
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.37.0"
4
+ "2.37.1"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.37.0
4
+ version: 2.37.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Schaal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-25 00:00:00.000000000 Z
11
+ date: 2017-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtext