win32-process 0.7.3 → 0.7.4
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/CHANGES +4 -0
- data/MANIFEST +4 -0
- data/examples/example_create.rb +35 -35
- data/examples/example_kill.rb +34 -34
- data/lib/win32/process.rb +1 -1
- data/lib/win32/process/constants.rb +5 -2
- data/test/test_win32_process.rb +1 -1
- data/win32-process.gemspec +3 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39dc3aa30a05db65cfb45dff067edea0f839f5b5
|
4
|
+
data.tar.gz: a13b9e2d70c63c9b532d87fe385386308e11301d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ad9884c726af4c9efbdc2f32cb36540fdeb17355a69a155853720f66025d9b5b8e35263bb14c6da012003daa835813a0b3680e5854088124ff2140916401aec
|
7
|
+
data.tar.gz: 6a30f65e1f17d01c59b09d602eb44783f7e959dda498f1630f877901d79ab4af48f073ce7578eb01a91e20c2d14c95c13757966444bf692133f5bc3db8fc48f3
|
data/CHANGES
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
= 0.7.4 - 21-Oct-2013
|
2
|
+
* Fixed the INVALID_HANDLE_VALUE constant for 64-bit versions of Ruby.
|
3
|
+
* Added Rake as a development dependency.
|
4
|
+
|
1
5
|
= 0.7.3 - 25-Sep-2013
|
2
6
|
* Added the Process.get_exitcode method. Thanks go to mthiede for the patch.
|
3
7
|
* The Process.kill method raises a SecurityError if the $SAFE level is 2
|
data/MANIFEST
CHANGED
data/examples/example_create.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
##########################################################################
|
2
|
-
# example_create.rb
|
3
|
-
#
|
4
|
-
# Simple test program for the Process.create() method. You can run this
|
5
|
-
# code via the 'example:create' task.
|
6
|
-
##########################################################################
|
7
|
-
require "win32/process"
|
8
|
-
|
9
|
-
p Process::WIN32_PROCESS_VERSION
|
10
|
-
|
11
|
-
struct = Process.create(
|
12
|
-
:app_name => "notepad.exe",
|
13
|
-
:creation_flags => Process::DETACHED_PROCESS,
|
14
|
-
:process_inherit => false,
|
15
|
-
:thread_inherit => true,
|
16
|
-
:cwd => "C:\\",
|
17
|
-
:inherit => true,
|
18
|
-
:environment => "SYSTEMROOT=#{ENV['SYSTEMROOT']};PATH=C:\\"
|
19
|
-
)
|
20
|
-
|
21
|
-
p struct
|
22
|
-
|
23
|
-
=begin
|
24
|
-
# Don't run this from an existing terminal
|
25
|
-
pid = Process.create(
|
26
|
-
:app_name => "cmd.exe",
|
27
|
-
:creation_flags => Process::DETACHED_PROCESS,
|
28
|
-
:startf_flags => Process::USEPOSITION,
|
29
|
-
:x => 0,
|
30
|
-
:y => 0,
|
31
|
-
:title => "Hi Dan"
|
32
|
-
)
|
33
|
-
|
34
|
-
puts "Pid of new process: #{pid}"
|
35
|
-
=end
|
1
|
+
##########################################################################
|
2
|
+
# example_create.rb
|
3
|
+
#
|
4
|
+
# Simple test program for the Process.create() method. You can run this
|
5
|
+
# code via the 'example:create' task.
|
6
|
+
##########################################################################
|
7
|
+
require "win32/process"
|
8
|
+
|
9
|
+
p Process::WIN32_PROCESS_VERSION
|
10
|
+
|
11
|
+
struct = Process.create(
|
12
|
+
:app_name => "notepad.exe",
|
13
|
+
:creation_flags => Process::DETACHED_PROCESS,
|
14
|
+
:process_inherit => false,
|
15
|
+
:thread_inherit => true,
|
16
|
+
:cwd => "C:\\",
|
17
|
+
:inherit => true,
|
18
|
+
:environment => "SYSTEMROOT=#{ENV['SYSTEMROOT']};PATH=C:\\"
|
19
|
+
)
|
20
|
+
|
21
|
+
p struct
|
22
|
+
|
23
|
+
=begin
|
24
|
+
# Don't run this from an existing terminal
|
25
|
+
pid = Process.create(
|
26
|
+
:app_name => "cmd.exe",
|
27
|
+
:creation_flags => Process::DETACHED_PROCESS,
|
28
|
+
:startf_flags => Process::USEPOSITION,
|
29
|
+
:x => 0,
|
30
|
+
:y => 0,
|
31
|
+
:title => "Hi Dan"
|
32
|
+
)
|
33
|
+
|
34
|
+
puts "Pid of new process: #{pid}"
|
35
|
+
=end
|
data/examples/example_kill.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
##########################################################################
|
2
|
-
# example_kill.rb
|
3
|
-
#
|
4
|
-
# Generic test script for futzing around Process.kill. This script
|
5
|
-
# requires the sys-proctable library.
|
6
|
-
#
|
7
|
-
# You can run this example via the 'example:kill' task.
|
8
|
-
##########################################################################
|
9
|
-
require "win32/process"
|
10
|
-
|
11
|
-
begin
|
12
|
-
require "sys/proctable"
|
13
|
-
rescue LoadError
|
14
|
-
STDERR.puts "Whoa there!"
|
15
|
-
STDERR.puts "This script requires the sys-proctable package to work."
|
16
|
-
STDERR.puts "You can find it at http://ruby-sysutils.sf.net"
|
17
|
-
STDERR.puts "Exiting..."
|
18
|
-
exit
|
19
|
-
end
|
20
|
-
|
21
|
-
include Sys
|
22
|
-
|
23
|
-
puts "VERSION: " + Process::WIN32_PROCESS_VERSION
|
24
|
-
|
25
|
-
IO.popen("notepad")
|
26
|
-
sleep 1 # Give it a chance to start before checking for its pid
|
27
|
-
|
28
|
-
pids = []
|
29
|
-
|
30
|
-
ProcTable.ps{ |s|
|
31
|
-
pids.push(s.pid) if s.cmdline =~ /notepad/i
|
32
|
-
}
|
33
|
-
|
34
|
-
p Process.kill(9,pids.last)
|
1
|
+
##########################################################################
|
2
|
+
# example_kill.rb
|
3
|
+
#
|
4
|
+
# Generic test script for futzing around Process.kill. This script
|
5
|
+
# requires the sys-proctable library.
|
6
|
+
#
|
7
|
+
# You can run this example via the 'example:kill' task.
|
8
|
+
##########################################################################
|
9
|
+
require "win32/process"
|
10
|
+
|
11
|
+
begin
|
12
|
+
require "sys/proctable"
|
13
|
+
rescue LoadError
|
14
|
+
STDERR.puts "Whoa there!"
|
15
|
+
STDERR.puts "This script requires the sys-proctable package to work."
|
16
|
+
STDERR.puts "You can find it at http://ruby-sysutils.sf.net"
|
17
|
+
STDERR.puts "Exiting..."
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
include Sys
|
22
|
+
|
23
|
+
puts "VERSION: " + Process::WIN32_PROCESS_VERSION
|
24
|
+
|
25
|
+
IO.popen("notepad")
|
26
|
+
sleep 1 # Give it a chance to start before checking for its pid
|
27
|
+
|
28
|
+
pids = []
|
29
|
+
|
30
|
+
ProcTable.ps{ |s|
|
31
|
+
pids.push(s.pid) if s.cmdline =~ /notepad/i
|
32
|
+
}
|
33
|
+
|
34
|
+
p Process.kill(9,pids.last)
|
data/lib/win32/process.rb
CHANGED
@@ -11,7 +11,7 @@ module Process
|
|
11
11
|
extend Process::Constants
|
12
12
|
|
13
13
|
# The version of the win32-process library.
|
14
|
-
WIN32_PROCESS_VERSION = '0.7.
|
14
|
+
WIN32_PROCESS_VERSION = '0.7.4'
|
15
15
|
|
16
16
|
# Disable popups. This mostly affects the Process.kill method.
|
17
17
|
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX)
|
@@ -1,4 +1,8 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
|
1
3
|
module Process::Constants
|
4
|
+
include FFI::Library
|
5
|
+
|
2
6
|
private
|
3
7
|
|
4
8
|
# Priority constants
|
@@ -12,7 +16,7 @@ module Process::Constants
|
|
12
16
|
|
13
17
|
# Error constants
|
14
18
|
|
15
|
-
INVALID_HANDLE_VALUE =
|
19
|
+
INVALID_HANDLE_VALUE = FFI::Pointer.new(-1).address
|
16
20
|
ERROR_ACCESS_DENIED = 0x00000005
|
17
21
|
|
18
22
|
# Process Access Rights
|
@@ -106,5 +110,4 @@ module Process::Constants
|
|
106
110
|
# GetExitCodeProcess
|
107
111
|
|
108
112
|
STILL_ACTIVE = 259
|
109
|
-
|
110
113
|
end
|
data/test/test_win32_process.rb
CHANGED
@@ -25,7 +25,7 @@ class TC_Win32Process < Test::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
test "win32-process version is set to the correct value" do
|
28
|
-
assert_equal('0.7.
|
28
|
+
assert_equal('0.7.4', Process::WIN32_PROCESS_VERSION)
|
29
29
|
end
|
30
30
|
|
31
31
|
test "create basic functionality" do
|
data/win32-process.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'win32-process'
|
5
|
-
spec.version = '0.7.
|
5
|
+
spec.version = '0.7.4'
|
6
6
|
spec.license = 'Artistic 2.0'
|
7
7
|
spec.authors = ['Daniel Berger', 'Park Heesob']
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
@@ -16,6 +16,8 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.required_ruby_version = '> 1.9.0'
|
18
18
|
spec.add_dependency('ffi', '>= 1.0.0')
|
19
|
+
|
20
|
+
spec.add_development_dependency('rake')
|
19
21
|
spec.add_development_dependency('test-unit', '>= 2.4.0')
|
20
22
|
|
21
23
|
spec.description = <<-EOF
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-process
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Berger
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 1.0.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: test-unit
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
100
|
version: '0'
|
87
101
|
requirements: []
|
88
102
|
rubyforge_project: win32utils
|
89
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.1.9
|
90
104
|
signing_key:
|
91
105
|
specification_version: 4
|
92
106
|
summary: Adds and redefines several Process methods for MS Windows
|