yamatanooroti 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yamatanooroti/version.rb +1 -1
- data/lib/yamatanooroti/windows.rb +22 -12
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c50ad7cbec4e89075f4acc1c3060abdc3451177a5087460a4e5120db8cbe62ba
|
4
|
+
data.tar.gz: 2e0b61f737a29e7eb949f6594bb1718dbb761555a22cd05a686fafddd931f228
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a9a3071d7eac0a2036fe3671b21a98fb84469ccb89a472380163f6d4ea98043925cff1a9548244d23d2aa44bac2cb062da6cdc0655b8c73fb54ec2136da5214
|
7
|
+
data.tar.gz: 6aabb244234bdd034fc0a870726b8d5ecf88e526c2a4483916c9a1caec51901d5408435b20a50053b25e019ad152e90a9935853e4c6c9db290dc0e383f1321ce
|
@@ -360,28 +360,38 @@ module Yamatanooroti::WindowsTestCaseModule
|
|
360
360
|
pe.dwSize = DL::PROCESSENTRY32W.size
|
361
361
|
r = DL.Process32FirstW(h_snap, pe)
|
362
362
|
error_message(r, "Process32First")
|
363
|
+
process_table = {}
|
363
364
|
loop do
|
364
365
|
#log "a #{pe.th32ParentProcessID.inspect} -> #{pe.th32ProcessID.inspect} #{wc2mb(pe.szExeFile.pack('S260')).unpack('Z*').pack('Z*')}"
|
365
|
-
|
366
|
-
|
367
|
-
if (h_child_proc)
|
368
|
-
r = DL.TerminateProcess(h_child_proc, 0)
|
369
|
-
error_message(r, "TerminateProcess")
|
370
|
-
r = DL.CloseHandle(h_child_proc)
|
371
|
-
error_message(r, "CloseHandle")
|
372
|
-
end
|
373
|
-
end
|
366
|
+
process_table[pe.th32ParentProcessID] ||= []
|
367
|
+
process_table[pe.th32ParentProcessID] << pe.th32ProcessID
|
374
368
|
break if DL.Process32NextW(h_snap, pe).zero?
|
375
369
|
end
|
376
|
-
|
377
|
-
|
378
|
-
|
370
|
+
process_table[DL.GetCurrentProcessId].each do |child_pid|
|
371
|
+
kill_process_tree(process_table, child_pid)
|
372
|
+
end
|
373
|
+
#r = DL.TerminateThread(@pi.hThread, 0)
|
374
|
+
#error_message(r, "TerminateThread")
|
375
|
+
#sleep @wait
|
379
376
|
r = DL.FreeConsole()
|
380
377
|
#error_message(r, "FreeConsole")
|
381
378
|
r = DL.AttachConsole(DL::ATTACH_PARENT_PROCESS)
|
382
379
|
error_message(r, 'AttachConsole')
|
383
380
|
end
|
384
381
|
|
382
|
+
private def kill_process_tree(process_table, pid)
|
383
|
+
process_table[pid]&.each do |child_pid|
|
384
|
+
kill_process_tree(process_table, child_pid)
|
385
|
+
end
|
386
|
+
h_proc = DL.OpenProcess(DL::PROCESS_ALL_ACCESS, 0, pid)
|
387
|
+
if (h_proc)
|
388
|
+
r = DL.TerminateProcess(h_proc, 0)
|
389
|
+
error_message(r, "TerminateProcess")
|
390
|
+
r = DL.CloseHandle(h_proc)
|
391
|
+
error_message(r, "CloseHandle")
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
385
395
|
def close
|
386
396
|
sleep @wait
|
387
397
|
# read first before kill the console process including output
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yamatanooroti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aycabta
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -70,7 +70,7 @@ homepage: https://github.com/aycabta/yamatanooroti
|
|
70
70
|
licenses:
|
71
71
|
- MIT
|
72
72
|
metadata: {}
|
73
|
-
post_install_message:
|
73
|
+
post_install_message:
|
74
74
|
rdoc_options: []
|
75
75
|
require_paths:
|
76
76
|
- lib
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
88
|
rubygems_version: 3.1.2
|
89
|
-
signing_key:
|
89
|
+
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Multi-platform real(?) terminal test framework
|
92
92
|
test_files: []
|