posix-spawn 0.3.6 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a758d442978f77e9c025e5221d612e26b870bb0c
4
+ data.tar.gz: 78cc34f97240c5f37ce70285f4967aa1fe15aa32
5
+ SHA512:
6
+ metadata.gz: 9b30ac20c707dc810eacd8f43158f3d641952e73ac367120acf204996d235085dbbc75dec527bfe60156ec9a5486418e1d0031c732c90375f4655f39c361de1c
7
+ data.tar.gz: adcaada88b55b3584cf6d671865730c12ab04069ad40833c462ae0d1db95c79c2d61113b56de126cfa3e49748ac032fb5c79193ab354ac500505d1381c655d9e
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  to copy page tables. In many common uses of fork(), where it is followed by one
5
5
  of the exec family of functions to spawn child processes (`Kernel#system`,
6
6
  `IO::popen`, `Process::spawn`, etc.), it's possible to remove this overhead by using
7
- the use of special process spawning interfaces (`posix_spawn()`, `vfork()`, etc.)
7
+ special process spawning interfaces (`posix_spawn()`, `vfork()`, etc.)
8
8
 
9
9
  The posix-spawn library aims to implement a subset of the Ruby 1.9 `Process::spawn`
10
10
  interface in a way that takes advantage of fast process spawning interfaces when
data/Rakefile CHANGED
@@ -6,8 +6,8 @@ task :default => :test
6
6
 
7
7
  GEMSPEC = eval(File.read('posix-spawn.gemspec'))
8
8
 
9
- require 'rake/gempackagetask'
10
- Rake::GemPackageTask.new(GEMSPEC) do |pkg|
9
+ require 'rubygems/package_task'
10
+ Gem::PackageTask.new(GEMSPEC) do |pkg|
11
11
  end
12
12
 
13
13
  # ==========================================================
@@ -3,7 +3,7 @@ require 'mkmf'
3
3
  # warnings save lives
4
4
  $CFLAGS << " -Wall "
5
5
 
6
- if RUBY_PLATFORM =~ /(mswin|mingw|bccwin)/
6
+ if RUBY_PLATFORM =~ /(mswin|mingw|cygwin|bccwin)/
7
7
  File.open('Makefile','w'){|f| f.puts "default: \ninstall: " }
8
8
  else
9
9
  create_makefile('posix_spawn_ext')
@@ -438,8 +438,10 @@ rb_posixspawn_pspawn(VALUE self, VALUE env, VALUE argv, VALUE options)
438
438
  }
439
439
 
440
440
  if (ret != 0) {
441
+ char error_context[PATH_MAX+32];
442
+ snprintf(error_context, sizeof(error_context), "when spawning '%s'", file);
441
443
  errno = ret;
442
- rb_sys_fail("posix_spawnp");
444
+ rb_sys_fail(error_context);
443
445
  }
444
446
 
445
447
  return INT2FIX(pid);
@@ -1,4 +1,4 @@
1
- unless RUBY_PLATFORM =~ /(mswin|mingw|bccwin)/
1
+ unless RUBY_PLATFORM =~ /(mswin|mingw|cygwin|bccwin)/
2
2
  require 'posix_spawn_ext'
3
3
  end
4
4
 
@@ -267,7 +267,12 @@ module POSIX
267
267
  # Returns the String output of the command.
268
268
  def `(cmd)
269
269
  r, w = IO.pipe
270
- pid = spawn(['/bin/sh', '/bin/sh'], '-c', cmd, :out => w, r => :close)
270
+ if RUBY_PLATFORM =~ /(mswin|mingw|cygwin|bccwin)/
271
+ sh = ENV['COMSPEC'] || 'cmd.exe'
272
+ pid = spawn([sh, sh], '/c', cmd, :out => w, r => :close)
273
+ else
274
+ pid = spawn(['/bin/sh', '/bin/sh'], '-c', cmd, :out => w, r => :close)
275
+ end
271
276
 
272
277
  if pid > 0
273
278
  w.close
@@ -285,7 +290,7 @@ module POSIX
285
290
  # the spawning process. Supports the standard spawn interface as described
286
291
  # in the POSIX::Spawn module documentation.
287
292
  #
288
- # Returns a [pid, stdin, stderr, stdout] tuple, where pid is the new
293
+ # Returns a [pid, stdin, stdout, stderr] tuple, where pid is the new
289
294
  # process's pid, stdin is a writeable IO object, and stdout / stderr are
290
295
  # readable IO objects. The caller should take care to close all IO objects
291
296
  # when finished and the child process's status must be collected by a call
@@ -309,7 +314,7 @@ module POSIX
309
314
  [pid, iwr, ord, erd]
310
315
  ensure
311
316
  # we're in the parent, close child-side fds
312
- [ird, owr, ewr].each { |fd| fd.close }
317
+ [ird, owr, ewr].each { |fd| fd.close if fd }
313
318
  end
314
319
 
315
320
  ##
@@ -146,7 +146,7 @@ module POSIX
146
146
  offset = 0
147
147
 
148
148
  # force all string and IO encodings to BINARY under 1.9 for now
149
- if out.respond_to?(:force_encoding)
149
+ if out.respond_to?(:force_encoding) and stdin.respond_to?(:set_encoding)
150
150
  [stdin, stdout, stderr].each do |fd|
151
151
  fd.set_encoding('BINARY', 'BINARY')
152
152
  end
@@ -1,5 +1,5 @@
1
1
  module POSIX
2
2
  module Spawn
3
- VERSION = '0.3.6'
3
+ VERSION = '0.3.8'
4
4
  end
5
5
  end
@@ -8,7 +8,6 @@ Gem::Specification.new do |s|
8
8
  s.description = 'posix-spawn uses posix_spawnp(2) for faster process spawning'
9
9
 
10
10
  s.homepage = 'http://github.com/rtomayko/posix-spawn'
11
- s.has_rdoc = false
12
11
 
13
12
  s.authors = ['Ryan Tomayko', 'Aman Gupta']
14
13
  s.email = ['r@tomayko.com', 'aman@tmm1.net']
metadata CHANGED
@@ -1,52 +1,42 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: posix-spawn
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 6
10
- version: 0.3.6
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.8
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Ryan Tomayko
14
8
  - Aman Gupta
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2011-04-19 00:00:00 -07:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
12
+ date: 2013-12-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: rake-compiler
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - "="
29
- - !ruby/object:Gem::Version
30
- hash: 15
31
- segments:
32
- - 0
33
- - 7
34
- - 6
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
35
20
  version: 0.7.6
36
21
  type: :development
37
- version_requirements: *id001
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '='
26
+ - !ruby/object:Gem::Version
27
+ version: 0.7.6
38
28
  description: posix-spawn uses posix_spawnp(2) for faster process spawning
39
- email:
29
+ email:
40
30
  - r@tomayko.com
41
31
  - aman@tmm1.net
42
- executables:
32
+ executables:
43
33
  - posix-spawn-benchmark
44
- extensions:
34
+ extensions:
45
35
  - ext/extconf.rb
46
- extra_rdoc_files:
36
+ extra_rdoc_files:
47
37
  - COPYING
48
38
  - HACKING
49
- files:
39
+ files:
50
40
  - .gitignore
51
41
  - COPYING
52
42
  - Gemfile
@@ -67,39 +57,27 @@ files:
67
57
  - test/test_popen.rb
68
58
  - test/test_spawn.rb
69
59
  - test/test_system.rb
70
- has_rdoc: true
71
60
  homepage: http://github.com/rtomayko/posix-spawn
72
61
  licenses: []
73
-
62
+ metadata: {}
74
63
  post_install_message:
75
64
  rdoc_options: []
76
-
77
- require_paths:
65
+ require_paths:
78
66
  - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
80
- none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
88
- required_rubygems_version: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
97
77
  requirements: []
98
-
99
78
  rubyforge_project:
100
- rubygems_version: 1.4.2
79
+ rubygems_version: 2.0.3
101
80
  signing_key:
102
- specification_version: 3
81
+ specification_version: 4
103
82
  summary: posix_spawnp(2) for ruby
104
83
  test_files: []
105
-