win32-process 0.5.1 → 0.5.2

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.
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.5.2 - 22-Jan-2007
2
+ * The startup_info parameter for the Process.create method now accepts
3
+ 'stdin', 'stdout', and 'stderr' as valid parameters, which you can pass
4
+ a Ruby IO object or a fileno in order to redirect output from the created
5
+ process.
6
+
1
7
  == 0.5.1 - 24-Aug-2006
2
8
  * Fixed a bug in the Process.create method where the return value for
3
9
  CreateProcess() was being evaluated incorrectly. Thanks go to David Haney
@@ -0,0 +1,11 @@
1
+ # For those who don't like gems...
2
+ require 'rbconfig'
3
+ require 'ftools'
4
+ include Config
5
+
6
+ sitelibdir = CONFIG['sitelibdir']
7
+ installdir = sitelibdir + '/win32'
8
+ file = 'lib\win32\process.rb'
9
+
10
+ Dir.mkdir(installdir) unless File.exists?(installdir)
11
+ File.copy(file, installdir, true)
@@ -9,7 +9,7 @@ require 'windows/window'
9
9
  class ProcessError < RuntimeError; end
10
10
 
11
11
  module Process
12
- WIN32_PROCESS_VERSION = '0.5.1'
12
+ WIN32_PROCESS_VERSION = '0.5.2'
13
13
 
14
14
  include Windows::Process
15
15
  include Windows::Error
@@ -240,17 +240,21 @@ module Process
240
240
  # * fill_attribute
241
241
  # * sw_flags
242
242
  # * startf_flags
243
+ # * stdin
244
+ # * stdout
245
+ # * stderr
243
246
  #
244
247
  # The relevant constants for 'creation_flags', 'sw_flags' and 'startf_flags'
245
248
  # are included in the Windows::Process, Windows::Console and Windows::Window
246
249
  # modules. These come with the windows-pr package, a prerequisite of this
247
- # package.
250
+ # package. Note that the 'stdin', 'stdout' and 'stderr' options can be
251
+ # either Ruby IO objects or file descriptors (i.e. a fileno). However,
252
+ # StringIO objects are not currently supported.
248
253
  #
249
254
  # The ProcessInfo struct contains the following members:
250
255
  #
251
- # * process_handle - The handle to the newly created process
252
- # * thread_handle - The handle to the primary thread of the newly created
253
- # process.
256
+ # * process_handle - The handle to the newly created process.
257
+ # * thread_handle - The handle to the primary thread of the process.
254
258
  # * process_id - Process ID.
255
259
  # * thread_id - Thread ID.
256
260
  #
@@ -291,7 +295,7 @@ module Process
291
295
  when true, false
292
296
  hash[key] = val == false ? 0 : 1
293
297
  when nil
294
- hash[key] = 0 # Win32API no likey nil
298
+ hash[key] = 0 # Win32API sometimes doesn't like nil
295
299
  else
296
300
  hash[key] = val
297
301
  end
@@ -341,6 +345,24 @@ module Process
341
345
  thread_security[0,4] = [12].pack('L') # sizeof(SECURITY_ATTRIBUTE)
342
346
  thread_security[8,4] = [hash['thread_inherit?']].pack('L')
343
347
  end
348
+
349
+ # Automatically handle stdin, stdout and stderr as either IO objects
350
+ # or file descriptors. This won't work for StringIO, however.
351
+ ['stdin', 'stdout', 'stderr'].each{ |io|
352
+ if si_hash[io]
353
+ if si_hash[io].respond_to?(:fileno)
354
+ handle = get_osfhandle(si_hash[io].fileno)
355
+ else
356
+ handle = get_osfhandle(si_hash[io])
357
+ end
358
+
359
+ if handle == INVALID_HANDLE_VALUE
360
+ raise ProcessError, get_last_error
361
+ end
362
+
363
+ si_hash[io] = handle
364
+ end
365
+ }
344
366
 
345
367
  # The bytes not covered here are reserved (null)
346
368
  unless si_hash.empty?
@@ -0,0 +1,24 @@
1
+ require "rubygems"
2
+
3
+ spec = Gem::Specification.new do |gem|
4
+ gem.name = "win32-process"
5
+ gem.version = "0.5.2"
6
+ gem.author = "Daniel J. Berger"
7
+ gem.email = "djberg96@gmail.com"
8
+ gem.homepage = "http://www.rubyforge.org/projects/win32utils"
9
+ gem.platform = Gem::Platform::RUBY
10
+ gem.summary = "Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method"
11
+ gem.description = "Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method"
12
+ gem.test_file = "test/tc_process.rb"
13
+ gem.has_rdoc = true
14
+ gem.files = Dir["lib/win32/*.rb"] + Dir["test/*"] + Dir["[A-Z]*"]
15
+ gem.files.reject! { |fn| fn.include? "CVS" }
16
+ gem.require_path = "lib"
17
+ gem.extra_rdoc_files = ["README", "CHANGES"]
18
+ gem.add_dependency("windows-pr", ">= 0.5.2")
19
+ end
20
+
21
+ if $0 == __FILE__
22
+ Gem.manage_gems
23
+ Gem::Builder.new(spec).build
24
+ end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.0.8
3
3
  specification_version: 1
4
4
  name: win32-process
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.1
7
- date: 2006-08-24 00:00:00 -06:00
6
+ version: 0.5.2
7
+ date: 2007-01-22 00:00:00 -07:00
8
8
  summary: Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method
9
9
  require_paths:
10
10
  - lib
@@ -34,8 +34,13 @@ files:
34
34
  - test/tc_process.rb
35
35
  - CHANGES
36
36
  - CVS
37
+ - examples
38
+ - install.rb
39
+ - lib
37
40
  - MANIFEST
38
41
  - README
42
+ - test
43
+ - win32-process.gemspec
39
44
  test_files:
40
45
  - test/tc_process.rb
41
46
  rdoc_options: []