sc2ai 0.4.3 → 0.5.0

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: aaa51c5d8ef4ec90b0da920e6fee5b5aef436612b316da1f6f47b9fbb213bb78
4
- data.tar.gz: c2a69316a5469f9074d471a0e3456d687f015148bb4f2483f7ef4945866fdce8
3
+ metadata.gz: 5b421602e2cdff4d59e4b3b4ab168f7d894a43f4474244b229ec72c78d6bf6a9
4
+ data.tar.gz: cbc072cb8a55cacabd0ac751ff5286f582c0145241a98343834f0c0def7c31c1
5
5
  SHA512:
6
- metadata.gz: 806ebc2a45c45bf69db2e25085a3e548cdc41cb97f7792603577d72e1e1e5db104dd5c0c82924ac1a2138ac1cd89770d29135688d75b266ee0fe2a9b784d768a
7
- data.tar.gz: 338f46f6bdccc9e847c57d7d3abff6b450c2f2ad507582ab601806ba8bcc5d82ba850cd95488c7be85c870cee634ba741e02c408c31cfffbeb9544561d9f0178
6
+ metadata.gz: df8e5f7a8557d0f3dce348cbd9dcdc8ef8f03f88b5f00376d7972b36c223e042ed61123612642189e2722b0a62eb22f7f02a16ca5650864bdd8f3a49ddc86680
7
+ data.tar.gz: d5094e865be75f4b7c31b25a41ff8f021edbb4380567f304a39c1ade99d3155fa408d821c980f2751daf85eddee3f8f9c84a81557255e923db524d9570fad817
@@ -67,7 +67,7 @@ module Sc2
67
67
  begin
68
68
  ::Async::Process.spawn(command_string, **options)
69
69
  rescue
70
- Sc2.logger.info("Client exited unexpectedly")
70
+ Sc2.logger.info("Client exited")
71
71
  task&.stop
72
72
  end
73
73
  end
@@ -68,6 +68,7 @@ module Sc2
68
68
  ensure
69
69
  Sc2.logger.debug { "Game over, disconnect players." }
70
70
  # Suppress interrupt errors #$stderr.reopen File.new(File::NULL, "w")
71
+ player.quit if Gem.win_platform?
71
72
  player.disconnect
72
73
  ClientManager.stop(player_index) # unless keep_clients_alive
73
74
  end
@@ -19,9 +19,10 @@ module Async
19
19
  options[:pgroup] = true
20
20
  end
21
21
 
22
- @pid = ::Process.spawn(*args, **options)
22
+
23
23
 
24
24
  @thread = Thread.new do
25
+ @pid = ::Process.spawn(*args, **options)
25
26
  _, @exit_status = ::Process.wait2(@pid)
26
27
  @output.close
27
28
  end
data/lib/sc2ai/paths.rb CHANGED
@@ -280,7 +280,6 @@ module Sc2
280
280
  # Platform-specific patches
281
281
  if platform == PF_WSL1 || platform == PF_WSL2
282
282
  dir = win_to_wsl(path: dir)
283
- raise Pathname(dir).inspect
284
283
  elsif PF_WINDOWS
285
284
  dir = dir.tr("\\", "/")
286
285
  end
data/lib/sc2ai/player.rb CHANGED
@@ -129,6 +129,15 @@ module Sc2
129
129
  @api&.close
130
130
  end
131
131
 
132
+ # @private
133
+ # Note: Do not document, because ladder players should never quit,
134
+ # but rather #leave_game instead
135
+ # Sends quit command to SC2
136
+ # @return [void]
137
+ def quit
138
+ @api&.quit
139
+ end
140
+
132
141
  # @!endgroup Connection
133
142
 
134
143
  # API --------------------