win32-process 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/MANIFEST CHANGED
@@ -1,15 +1,15 @@
1
- * CHANGES
2
- * README
3
- * MANIFEST
4
- * Rakefile
5
- * win32-process.gemspec
6
- * certs/djberg96_pub.pem
7
- * examples/example_create.rb
8
- * examples/example_kill.rb
9
- * lib/win32-process.rb
10
- * lib/win32/process.rb
11
- * lib/win32/process/constants.rb
12
- * lib/win32/process/functions.rb
13
- * lib/win32/process/helper.rb
14
- * lib/win32/process/structs.rb
15
- * test/test_process.rb
1
+ * CHANGES
2
+ * README
3
+ * MANIFEST
4
+ * Rakefile
5
+ * win32-process.gemspec
6
+ * certs/djberg96_pub.pem
7
+ * examples/example_create.rb
8
+ * examples/example_kill.rb
9
+ * lib/win32-process.rb
10
+ * lib/win32/process.rb
11
+ * lib/win32/process/constants.rb
12
+ * lib/win32/process/functions.rb
13
+ * lib/win32/process/helper.rb
14
+ * lib/win32/process/structs.rb
15
+ * test/test_process.rb
data/README CHANGED
@@ -1,78 +1,78 @@
1
- = Description
2
- This library provides analogues of the :getpriority, :setpriority, :getrlimit,
3
- :setrlimit and :uid methods for MS Windows. It also adds the new methods :job?,
4
- :get_affinity, and :create, and redefines the :kill method.
5
-
6
- = Prerequisites
7
- * ffi
8
- * sys-proctable (dev only)
9
- * test-unit 2 (dev only)
10
-
11
- = Supported Platforms
12
- This library is supported on Windows 2000 or later.
13
-
14
- = Installation
15
- gem install win32-process
16
-
17
- = Synopsis
18
- require 'win32/process'
19
-
20
- p Process.job? # => true or false
21
-
22
- info = Process.create(
23
- :app_name => "notepad.exe",
24
- :creation_flags => Process::DETACHED_PROCESS,
25
- :process_inherit => false,
26
- :thread_inherit => true,
27
- :cwd => "C:\\"
28
- )
29
-
30
- p info.process_id
31
-
32
- = Developer's Notes
33
- == Removal of Process.fork in release 0.7.0
34
- The Process.fork method was originally experimental but it has never
35
- been particularly useful in practice. On top of that, it required special
36
- implementations of the Process.waitXXX methods, so it was a maintenance
37
- issue as well.
38
-
39
- With Ruby 1.9 now becoming standard and its addition of Process.spawn
40
- and friends (and concomitant support for the Process.waitXXX methods) I
41
- felt it was time to remove it.
42
-
43
- You can still simulate Process.fork if you like using Process.create, which
44
- is how it was implemented internally anyway. A better solution might be
45
- to follow in the footsteps of ActiveState Perl, which uses native threads
46
- to simulate fork on Windows.
47
-
48
- == Changes in the custom Process.kill method for 0.7.0
49
- The Process.kill method in 0.7.0 more closely matches the spec now, but
50
- the internal method for killing processes is still nicer for most signals.
51
- With the release of 0.7.0 users can now specify options that provide finer
52
- control over how a process is killed. See the documentation for details.
53
-
54
- == The removal of the custom Process.ppid method
55
- This was added at some point in the Ruby 1.9 dev cycle so it was removed
56
- from this library.
57
-
58
- = Known Issues
59
- JRuby doesn't seem to like SIGBRK for Process.kill.
60
-
61
- Any issues or bugs should be reported on the project page at
62
- https://github.com/djberg96/win32-process.
63
-
64
- = License
65
- Artistic 2.0
66
-
67
- = Copyright
68
- (C) 2003-2015 Daniel J. Berger
69
- All Rights Reserved
70
-
71
- = Warranty
72
- This library is provided "as is" and without any express or
73
- implied warranties, including, without limitation, the implied
74
- warranties of merchantability and fitness for a particular purpose.
75
-
76
- = Author(s)
77
- Park Heesob
78
- Daniel J. Berger
1
+ = Description
2
+ This library provides analogues of the :getpriority, :setpriority, :getrlimit,
3
+ :setrlimit and :uid methods for MS Windows. It also adds the new methods :job?,
4
+ :get_affinity, and :create, and redefines the :kill method.
5
+
6
+ = Prerequisites
7
+ * ffi
8
+ * sys-proctable (dev only)
9
+ * test-unit 2 (dev only)
10
+
11
+ = Supported Platforms
12
+ This library is supported on Windows 2000 or later.
13
+
14
+ = Installation
15
+ gem install win32-process
16
+
17
+ = Synopsis
18
+ require 'win32/process'
19
+
20
+ p Process.job? # => true or false
21
+
22
+ info = Process.create(
23
+ :app_name => "notepad.exe",
24
+ :creation_flags => Process::DETACHED_PROCESS,
25
+ :process_inherit => false,
26
+ :thread_inherit => true,
27
+ :cwd => "C:\\"
28
+ )
29
+
30
+ p info.process_id
31
+
32
+ = Developer's Notes
33
+ == Removal of Process.fork in release 0.7.0
34
+ The Process.fork method was originally experimental but it has never
35
+ been particularly useful in practice. On top of that, it required special
36
+ implementations of the Process.waitXXX methods, so it was a maintenance
37
+ issue as well.
38
+
39
+ With Ruby 1.9 now becoming standard and its addition of Process.spawn
40
+ and friends (and concomitant support for the Process.waitXXX methods) I
41
+ felt it was time to remove it.
42
+
43
+ You can still simulate Process.fork if you like using Process.create, which
44
+ is how it was implemented internally anyway. A better solution might be
45
+ to follow in the footsteps of ActiveState Perl, which uses native threads
46
+ to simulate fork on Windows.
47
+
48
+ == Changes in the custom Process.kill method for 0.7.0
49
+ The Process.kill method in 0.7.0 more closely matches the spec now, but
50
+ the internal method for killing processes is still nicer for most signals.
51
+ With the release of 0.7.0 users can now specify options that provide finer
52
+ control over how a process is killed. See the documentation for details.
53
+
54
+ == The removal of the custom Process.ppid method
55
+ This was added at some point in the Ruby 1.9 dev cycle so it was removed
56
+ from this library.
57
+
58
+ = Known Issues
59
+ JRuby doesn't seem to like SIGBRK for Process.kill.
60
+
61
+ Any issues or bugs should be reported on the project page at
62
+ https://github.com/djberg96/win32-process.
63
+
64
+ = License
65
+ Artistic 2.0
66
+
67
+ = Copyright
68
+ (C) 2003-2015 Daniel J. Berger
69
+ All Rights Reserved
70
+
71
+ = Warranty
72
+ This library is provided "as is" and without any express or
73
+ implied warranties, including, without limitation, the implied
74
+ warranties of merchantability and fitness for a particular purpose.
75
+
76
+ = Author(s)
77
+ Park Heesob
78
+ Daniel J. Berger
data/Rakefile CHANGED
@@ -1,60 +1,60 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'rake/testtask'
4
- require 'rbconfig'
5
- include RbConfig
6
-
7
- CLEAN.include('**/*.gem', '**/*.rbc', '**/*.log')
8
-
9
- namespace :gem do
10
- desc 'Create the win32-process gem'
11
- task :create => [:clean] do
12
- spec = eval(IO.read('win32-process.gemspec'))
13
- spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
14
- require 'rubygems/package'
15
- Gem::Package.build(spec)
16
- end
17
-
18
- desc 'Install the win32-process gem'
19
- task :install => [:create] do
20
- file = Dir["*.gem"].first
21
- sh "gem install -l #{file}"
22
- end
23
- end
24
-
25
- namespace :example do
26
- desc 'Run the fork + wait example'
27
- task :fork_wait do
28
- sh "ruby -Ilib examples/example_fork_wait.rb"
29
- end
30
-
31
- desc 'Run the fork + waitpid example'
32
- task :fork_waitpid do
33
- sh "ruby -Ilib examples/example_fork_waitpid.rb"
34
- end
35
-
36
- desc 'Run the kill example'
37
- task :kill do
38
- sh "ruby -Ilib examples/example_kill.rb"
39
- end
40
-
41
- desc 'Run the create example'
42
- task :create do
43
- sh "ruby -Ilib examples/example_create.rb"
44
- end
45
- end
46
-
47
- namespace :test do
48
- Rake::TestTask.new(:kill) do |t|
49
- t.verbose = true
50
- t.warning = true
51
- t.test_files = FileList['test/test_win32_process_kill.rb']
52
- end
53
- end
54
-
55
- Rake::TestTask.new do |t|
56
- t.verbose = true
57
- t.warning = true
58
- end
59
-
60
- task :default => :test
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'rbconfig'
5
+ include RbConfig
6
+
7
+ CLEAN.include('**/*.gem', '**/*.rbc', '**/*.log')
8
+
9
+ namespace :gem do
10
+ desc 'Create the win32-process gem'
11
+ task :create => [:clean] do
12
+ spec = eval(IO.read('win32-process.gemspec'))
13
+ spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
14
+ require 'rubygems/package'
15
+ Gem::Package.build(spec)
16
+ end
17
+
18
+ desc 'Install the win32-process gem'
19
+ task :install => [:create] do
20
+ file = Dir["*.gem"].first
21
+ sh "gem install -l #{file}"
22
+ end
23
+ end
24
+
25
+ namespace :example do
26
+ desc 'Run the fork + wait example'
27
+ task :fork_wait do
28
+ sh "ruby -Ilib examples/example_fork_wait.rb"
29
+ end
30
+
31
+ desc 'Run the fork + waitpid example'
32
+ task :fork_waitpid do
33
+ sh "ruby -Ilib examples/example_fork_waitpid.rb"
34
+ end
35
+
36
+ desc 'Run the kill example'
37
+ task :kill do
38
+ sh "ruby -Ilib examples/example_kill.rb"
39
+ end
40
+
41
+ desc 'Run the create example'
42
+ task :create do
43
+ sh "ruby -Ilib examples/example_create.rb"
44
+ end
45
+ end
46
+
47
+ namespace :test do
48
+ Rake::TestTask.new(:kill) do |t|
49
+ t.verbose = true
50
+ t.warning = true
51
+ t.test_files = FileList['test/test_win32_process_kill.rb']
52
+ end
53
+ end
54
+
55
+ Rake::TestTask.new do |t|
56
+ t.verbose = true
57
+ t.warning = true
58
+ end
59
+
60
+ task :default => :test
@@ -1,21 +1,21 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
3
- cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
4
- MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
5
- ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
6
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
7
- Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI
8
- S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
9
- gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
10
- FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
11
- zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTm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FZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
9
+ gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
10
+ FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
11
+ zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl
12
+ DtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe
13
+ nn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
14
+ bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
15
+ ggEBAHmNOCWoDVD75zHFueY0viwGDVP1BNGFC+yXcb7u2GlK+nEMCORqzURbYPf7
16
+ tL+/hzmePIRz7i30UM//64GI1NLv9jl7nIwjhPpXpf7/lu2I9hOTsvwSumb5UiKC
17
+ /sqBxI3sfj9pr79Wpv4MuikX1XPik7Ncb7NPsJPw06Lvyc3Hkg5X2XpPtLtS+Gr2
18
+ wKJnmzb5rIPS1cmsqv0M9LPWflzfwoZ/SpnmhagP+g05p8bRNKjZSA2iImM/GyYZ
19
+ EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
20
+ tGSHgAmcLlkdGgan182qsE/4kKM=
21
+ -----END CERTIFICATE-----
@@ -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
@@ -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)