posix-spawn 0.3.12 → 0.3.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5e7aaeb2727c0c2d0d4b1055fee451289ddd510b
4
- data.tar.gz: 87bcf9d8cc5cd759a6dc985a683b2a6d44dd8152
2
+ SHA256:
3
+ metadata.gz: e80888255d57122ba2ad477c456582e0ebfdd05a61b175c60577ee8b38e579ad
4
+ data.tar.gz: 12d37e71310f0127b75b0f31da196c9c7554cac29a31d63754583f7737132190
5
5
  SHA512:
6
- metadata.gz: 4f94bf7abd676780045ffb4c7d010cb0cc626d1fe6bbe84fab3126c4764a14f3828266db52f5ffa1eed5827ce0cac988b53f443bf9fed2bfd37110f6b55092f5
7
- data.tar.gz: 20f06443465c1b96e06f988ca0c9b74df329cb13bbc0cb132217fa9453d35680e539de59492bfb2fe65bdd37c5c3d2b36a970899fd5fe860a04c0a9206530a09
6
+ metadata.gz: 3371e197b9b63ec2dce0b64d070bce8628ccb63112bcd14e8f7426891d1acf4d4ce4bc9558f44a832eaabd194b4b11a7feb2f12db2dd1d6db60968b8b9bc1a2a
7
+ data.tar.gz: 4d63126f9866a66ac6cc50d811be076939e1048f490aa40c55db1931398e016d225c3ae3da939a93646be551e6b207066f1dd4d2a1ee4f7dfe859a4404325242
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 1.9
5
+ - 2.0
6
+ - 2.2
7
+ - 2.4
8
+ - 2.6
9
+ - ruby-head
data/ext/posix-spawn.c CHANGED
@@ -45,7 +45,7 @@ static VALUE rb_mPOSIXSpawn;
45
45
  * an actual fd number:
46
46
  * - The symbols :in, :out, or :err for fds 0, 1, or 2.
47
47
  * - An IO object. (IO#fileno is returned)
48
- * - A Fixnum.
48
+ * - An Integer.
49
49
  *
50
50
  * Returns the fd number >= 0 if one could be established, or -1 if the object
51
51
  * does not map to an fd.
@@ -56,7 +56,11 @@ posixspawn_obj_to_fd(VALUE obj)
56
56
  int fd = -1;
57
57
  switch (TYPE(obj)) {
58
58
  case T_FIXNUM:
59
- /* Fixnum fd number */
59
+ case T_BIGNUM:
60
+ /* Integer fd number
61
+ * rb_fix2int takes care of raising if the provided object is a
62
+ * Bignum and is out of range of an int
63
+ */
60
64
  fd = FIX2INT(obj);
61
65
  break;
62
66
 
@@ -94,7 +98,7 @@ posixspawn_obj_to_fd(VALUE obj)
94
98
  /*
95
99
  * Hash iterator that sets up the posix_spawn_file_actions_t with addclose
96
100
  * operations. Only hash pairs whose value is :close are processed. Keys may
97
- * be the :in, :out, :err, an IO object, or a Fixnum fd number.
101
+ * be the :in, :out, :err, an IO object, or an Integer fd number.
98
102
  *
99
103
  * Returns ST_DELETE when an addclose operation was added; ST_CONTINUE when
100
104
  * no operation was performed.
@@ -279,6 +283,11 @@ each_env_i(VALUE key, VALUE val, VALUE arg)
279
283
  const char *ev = envp[i];
280
284
 
281
285
  if (strlen(ev) > name_len && !memcmp(ev, name, name_len) && ev[name_len] == '=') {
286
+ /* This operates on a duplicated environment -- release the
287
+ * existing entry memory before shifting the subsequent entry
288
+ * pointers down. */
289
+ free(envp[i]);
290
+
282
291
  for (j = i; envp[j]; ++j)
283
292
  envp[j] = envp[j + 1];
284
293
  continue;
@@ -1,5 +1,3 @@
1
- require 'posix/spawn'
2
-
3
1
  module POSIX
4
2
  module Spawn
5
3
  # POSIX::Spawn::Child includes logic for executing child processes and
@@ -1,5 +1,5 @@
1
1
  module POSIX
2
2
  module Spawn
3
- VERSION = '0.3.12'
3
+ VERSION = '0.3.15'
4
4
  end
5
5
  end
data/lib/posix/spawn.rb CHANGED
@@ -85,7 +85,7 @@ module POSIX
85
85
  #
86
86
  # spawn(command, :chdir => "/var/tmp")
87
87
  #
88
- # The :in, :out, :err, a Fixnum, an IO object or an Array option specify
88
+ # The :in, :out, :err, an Integer, an IO object or an Array option specify
89
89
  # fd redirection. For example, stderr can be merged into stdout as follows:
90
90
  #
91
91
  # spawn(command, :err => :out)
@@ -460,11 +460,11 @@ module POSIX
460
460
 
461
461
  # Determine whether object is fd-like.
462
462
  #
463
- # Returns true if object is an instance of IO, Fixnum >= 0, or one of the
463
+ # Returns true if object is an instance of IO, Integer >= 0, or one of the
464
464
  # the symbolic names :in, :out, or :err.
465
465
  def fd?(object)
466
466
  case object
467
- when Fixnum
467
+ when Integer
468
468
  object >= 0
469
469
  when :in, :out, :err, STDIN, STDOUT, STDERR, $stdin, $stdout, $stderr, IO
470
470
  true
@@ -486,7 +486,7 @@ module POSIX
486
486
  STDOUT
487
487
  when :err, 2
488
488
  STDERR
489
- when Fixnum
489
+ when Integer
490
490
  object >= 0 ? IO.for_fd(object) : nil
491
491
  when IO
492
492
  object
@@ -529,7 +529,7 @@ module POSIX
529
529
  #
530
530
  # Returns a [[cmdname, argv0], argv1, ...] array.
531
531
  def adjust_process_spawn_argv(args)
532
- if args.size == 1 && args[0] =~ /[ |>]/
532
+ if args.size == 1 && args[0].is_a?(String) && args[0] =~ /[ |>]/
533
533
  # single string with these characters means run it through the shell
534
534
  command_and_args = system_command_prefixes + [args[0]]
535
535
  [*command_and_args]
data/test/test_spawn.rb CHANGED
@@ -322,7 +322,7 @@ module SpawnImplementationTests
322
322
  end
323
323
  end
324
324
 
325
- assert_match /oops/, exception.message
325
+ assert_match(/oops/, exception.message)
326
326
  end
327
327
 
328
328
  ##
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posix-spawn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tomayko
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-11-03 00:00:00.000000000 Z
12
+ date: 2020-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -52,6 +52,7 @@ extra_rdoc_files:
52
52
  - HACKING
53
53
  files:
54
54
  - ".gitignore"
55
+ - ".travis.yml"
55
56
  - COPYING
56
57
  - Gemfile
57
58
  - HACKING
@@ -91,10 +92,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
92
  - !ruby/object:Gem::Version
92
93
  version: '0'
93
94
  requirements: []
94
- rubyforge_project:
95
- rubygems_version: 2.4.5.1
95
+ rubygems_version: 3.0.3
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: posix_spawnp(2) for ruby
99
99
  test_files: []
100
- has_rdoc: