after 0.3.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/after +1 -1
- data/lib/after.rb +2 -2
- data/spec/sleep.bat +1 -0
- data/spec/spec.after.rb +25 -9
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/bin/after
CHANGED
data/lib/after.rb
CHANGED
@@ -5,11 +5,11 @@ require 'wait_pid'
|
|
5
5
|
class After
|
6
6
|
|
7
7
|
def self.find_pids(many_args)
|
8
|
-
|
9
8
|
procs = WMI::Win32_Process.find(:all)
|
9
|
+
#_dbg
|
10
10
|
pids = []
|
11
11
|
for proc in procs # TODO respect proc.Name!
|
12
|
-
if proc.CommandLine && proc.CommandLine.contain?(many_args)
|
12
|
+
if (proc.CommandLine && proc.CommandLine.contain?(many_args)) || proc.Name.include?(many_args)
|
13
13
|
pid = proc.ProcessId.to_i
|
14
14
|
next if pid == Process.pid
|
15
15
|
pids << pid
|
data/spec/sleep.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby sleep.rb %*
|
data/spec/spec.after.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec/autorun'
|
2
2
|
require 'sane'
|
3
|
-
|
3
|
+
require_relative '../lib/after'
|
4
4
|
|
5
5
|
describe After do
|
6
6
|
|
@@ -37,22 +37,38 @@ describe After do
|
|
37
37
|
assert (Time.now - start) > 2
|
38
38
|
end
|
39
39
|
|
40
|
-
it "should split the commands up right and across name, too"
|
41
|
-
|
42
|
-
it "should respect name"
|
43
|
-
|
44
40
|
it "should not return the PID of this process" do
|
45
41
|
a = After.find_pids('ruby')
|
46
42
|
assert !Process.pid.in?(a)
|
47
43
|
end
|
48
44
|
|
49
|
-
it "should run all args" do
|
50
|
-
go 0
|
51
|
-
end
|
52
|
-
|
53
45
|
it "should allow for passing in a pid" do
|
54
46
|
pid = go 1
|
55
47
|
After.wait_pid pid
|
56
48
|
end
|
57
49
|
|
50
|
+
it "should find .bat filenames" do
|
51
|
+
# unfortunately I don't know how to query for exact parameters, though...
|
52
|
+
pid = Process.spawn "cmd /c sleep.bat 1"
|
53
|
+
Thread.new { Process.wait pid } # wait for it, so we can collect child processes, too
|
54
|
+
a = After.find_pids('sleep.bat')
|
55
|
+
assert a == [pid]
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
it "should find .bat filenames when run by selves" do
|
60
|
+
# unfortunately I don't know how to query for exact parameters, though...
|
61
|
+
pid = Process.spawn "sleep.bat 1"
|
62
|
+
Thread.new { Process.wait pid } # wait for it, so we can collect child processes, too
|
63
|
+
a = After.find_pids('sleep.bat')
|
64
|
+
assert a == [pid]
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should find exe names too" do
|
68
|
+
a = After.find_pids('csrss') # only searchable via name of csrss.exe
|
69
|
+
assert a.length == 1
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should split the commands up right and across name, too"
|
73
|
+
|
58
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: after
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rogerdpack
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-07 00:00:00 -07:00
|
13
13
|
default_executable: after
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- bin/after
|
80
80
|
- lib/after.rb
|
81
81
|
- spec/helper.rb
|
82
|
+
- spec/sleep.bat
|
82
83
|
- spec/sleep.rb
|
83
84
|
- spec/spec.after.rb
|
84
85
|
has_rdoc: true
|