GithubHelp home page GithubHelp logo

posix-spawn's People

Contributors

anatol avatar arrbee avatar bkeepers avatar brianmario avatar duckpuppy avatar eileencodes avatar hotovson avatar jacobvosmaer avatar jsvine avatar juanitofatas avatar justincase avatar ktdreyer avatar mattn avatar ncopa avatar nono avatar parkr avatar psasnyk avatar pterjan avatar rtomayko avatar takahashim avatar tmm1 avatar tnm avatar twp avatar uberjay avatar vmg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

posix-spawn's Issues

strange failure on rubinius

I fixed compilation issues and a couple other test failures against the latest rbx release, but couldn't figure out what's causing this failure:

Started
....................................................................................hiya
F.................
Finished in 5.119071 seconds.

  1) Failure:
test_spawn_redirect_invalid_fds_raises_exception(PosixSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:159:in `test_spawn_redirect_invalid_fds_raises_exception'
     kernel/bootstrap/array.rb:76:in `each'
     kernel/bootstrap/array.rb:76:in `each']:
<127> expected but was
<0>.

102 tests, 316 assertions, 1 failures, 0 errors

Windows - 'which' is not recognized as an internal or external command

Hi. I've just recently dug into Jekyll. I'm running it over RubyInstaller on Windows 7.
I'm able to get the basic site running on localhost:4000, and I seem to have all dependencies installed,
but whenever I run a jekyll command such as build or serve in PowerShell, I get the following warning
regarding posix-spawn. Please see the pasted excerpt below and let me know if this is a crucial issue that will give me more problems, and whether I can solve it myself locally.
Thanks!

my-blog $ jekyll serve
Notice: for 10x faster LSI support, please install http://rb-gsl.rubyforge.org/
Configuration file: C:/dev/projects/my-blog/_config.yml
            Source: C:/dev/projects/my-blog
       Destination: C:/dev/projects/my-blog/_site
      Generating...
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164
: warning: cannot close fd before spawn
'which' is not recognized as an internal or external command,
operable program or batch file.
                    done.
Configuration file: C:/dev/projects/my-blog/_config.yml
    Server address: http://0.0.0.0:4000/
  Server running... press ctrl-c to stop.

deprecation warning in ruby 2.4

After upgrading to ruby 2.4, gem generates warnings:

/usr/local/lib/ruby/gems/2.4.0/gems/posix-spawn-0.3.12/lib/posix/spawn.rb:467: warning: constant ::Fixnum is deprecated

0.3.8 support 32 bit OS ?

/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:220: warning: Insecure world writable dir /home/git/gitlab/.bundle/ruby/2.0.0/bin in PATH, mode 040777
rake aborted!
/home/git/gitlab/.bundle/ruby/2.0.0/gems/posix-spawn-0.3.8/lib/posix_spawn_ext.so: wrong ELF class: ELFCLASS64 - /home/git/gitlab/.bundle/ruby/2.0.0/gems/posix-spawn-0.3.8/lib/posix_spawn_ext.so
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/posix-spawn-0.3.8/lib/posix/spawn.rb:2:in `<top (required)>'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/posix-spawn-0.3.8/lib/posix-spawn.rb:1:in `<top (required)>'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/gitlab-grit-2.6.4/lib/grit/git.rb:2:in `<top (required)>'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/gitlab-grit-2.6.4/lib/grit.rb:34:in `<top (required)>'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/gitlab_git-5.4.0/lib/gitlab_git.rb:4:in `<top (required)>'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
/home/git/gitlab/config/application.rb:6:in `<top (required)>'
/home/git/gitlab/Rakefile:5:in `require'
/home/git/gitlab/Rakefile:5:in `<top (required)>'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/home/git/gitlab/.bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'

It seems the 0.3.8 will use the posix_spawn_ext.so which is target for 64 bit OS, how to use it on 32 bit OS/VM?

[JRuby] ERROR: Failed to build gem native extension.

Tried with gcc-4.2 and llvm.

Building native extensions.  This could take a while...
ERROR:  Error installing posix-spawn:
    ERROR: Failed to build gem native extension.

        /path/to/.rvm/rubies/jruby-1.6.7/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
creating Makefile


Gem files will remain installed in /path/to/.rvm/gems/jruby-1.6.7@global/gems/posix-spawn-0.3.6 for inspection.
Results logged to /path/to/.rvm/gems/jruby-1.6.7@global/gems/posix-spawn-0.3.6/ext/gem_make.out

coompiling posix-spawn on mac failed

logs below:

Building native extensions.  This could take a while...
ERROR:  Error installing posix-spawn-0.3.11.gem:
    ERROR: Failed to build gem native extension.

    /Users/yuebin/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -r ./siteconf20160118-38001-k13rjh.rb extconf.rb
creating Makefile

make  clean

make
compiling posix-spawn.c
posix-spawn.c:6:19: fatal error: errno.h: No such file or directory
 #include <errno.h>
                   ^
compilation terminated.
make: *** [posix-spawn.o] Error 1

make failed, exit code 2

Help me, please!

Get an error when compiling posix-spawn 0.3.13

# ruby -Cext extconf.rb
creating Makefile
# cd ext && make
compiling posix-spawn.c                                                                                  
posix-spawn.c: In function ‘posixspawn_obj_to_fd’:
posix-spawn.c:64:14: warning: implicit declaration of function ‘rb_fix2int’ [-Wimplicit-function-declaration]                                                                                                     
    fd = (int)rb_fix2int(obj);                                                                           
              ^
linking shared-object posix_spawn_ext.so                                                                 
posix-spawn.o: In function `posixspawn_obj_to_fd':                                                       
posix-spawn.c:(.text+0x1c4): undefined reference to `rb_fix2int'                                         
collect2: error: ld returned 1 exit status                                                               
make: *** [Makefile:256: posix_spawn_ext.so] Error 1

My ruby version

# ruby -v
ruby 2.3.5p376 (2017-09-14 revision 59905) [armv7a-linux-eabi]

Any ideas about what is going wrong?

Posix::Spawn::Child gets stuck when restarting service

I've tested this on ruby1.9 and ruby2.0 and tried different versions of posix-spawn gem. These include 0.3.5, 0.3.9, 0.3.11. This snippet I had ran on Amazon Linux as root user. Here is example of code:

    require 'pp'
    require 'posix-spawn'
    # I've used mcollective here, but other services I've tried gave same result
    formulate_command = "service mcollective restart"
    pp 'start'
    process = POSIX::Spawn::Child.new(formulate_command)
    pp process
    pp 'end'

This will freeze and it will never return process object, I've debugged code and it freezes on line https://github.com/rtomayko/posix-spawn/blob/master/lib/posix/spawn/child.rb#L228.

Interesting thing is, if I run same command with sudo prefix it will work.

Also both commands will work if run with Kernel#system and Kernel#``. POSIX::Spawn#popen4` will also not work for case described above.

EDIT

After some investigation I find that this issue is probably related to this http://stackoverflow.com/questions/8952043/how-to-fix-hanging-popen3-in-ruby

BacktickTest#test_backtick_huge hangs on OSX

The yes | head -50000 hangs on OSX. The process is still there, either the piping doesn't work or something else? Running the command in bash obviously is fine. Either way posix-spawn ends up waiting on io.read.

Several testsuite-issues when building for Fedora 20 or Red Hat / CentOS

Hello!

I'm currently working on a native Fedora && Red Hat / CentOS rpm for this, but the testsuite exhibits some failures, unfortunately:

Running tests:

.yes: standard output: Broken pipe
yes: write error
...................../bin/sh: 8: Bad file descriptor
FF...................................................................../bin/sh: 8: Bad file descriptor
FF.hiya
F........................................
Finished tests in 0.773485s, 177.1204 tests/s, 584.3682 assertions/s.

  1. Failure:
    ForkSpawnTest#test_explicitly_passing_an_fd_as_open [/builddir/build/BUILD/posix-spawn-0.3.8/test/test_spawn.rb:185]:
    <0> expected but was
    <1>.
  2. Failure:
    ForkSpawnTest#test_sanity_of_checking_clone_with_sh [/builddir/build/BUILD/posix-spawn-0.3.8/test/test_spawn.rb:72]:
    <0> expected but was
    <1>.
  3. Failure:
    PosixSpawnTest#test_explicitly_passing_an_fd_as_open [/builddir/build/BUILD/posix-spawn-0.3.8/test/test_spawn.rb:185]:
    <0> expected but was
    <1>.
  4. Failure:
    PosixSpawnTest#test_sanity_of_checking_clone_with_sh [/builddir/build/BUILD/posix-spawn-0.3.8/test/test_spawn.rb:72]:
    <0> expected but was
    <1>.
  5. Failure:
    PosixSpawnTest#test_spawn_close_invalid_fd_raises_exception [/builddir/build/BUILD/posix-spawn-0.3.8/test/test_spawn.rb:119]:
    <127> expected but was
    <0>.
    137 tests, 452 assertions, 5 failures, 0 errors, 0 skips
    ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
    rake aborted!
    Command failed with status (5): [ruby -I"lib" -I"/usr/share/gems/gems/rake-10.0.4/lib" "/usr/share/gems/gems/rake-10.0.4/lib/rake/rake_test_loader.rb" "test/test_backtick.rb" "test/test_child.rb" "test/test_popen.rb" "test/test_spawn.rb" "test/test_system.rb" ]
    /usr/share/gems/gems/rake-10.0.4/lib/rake/testtask.rb:104:in block (3 levels) in define' /usr/share/gems/gems/rake-10.0.4/lib/rake/file_utils.rb:45:incall'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in sh' /usr/share/gems/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:insh'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/file_utils.rb:82:in ruby' /usr/share/gems/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:inruby'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/testtask.rb:100:in block (2 levels) in define' /usr/share/gems/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:58:inverbose'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/testtask.rb:98:in block in define' /usr/share/gems/gems/rake-10.0.4/lib/rake/task.rb:246:incall'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/task.rb:246:in block in execute' /usr/share/gems/gems/rake-10.0.4/lib/rake/task.rb:241:ineach'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/task.rb:241:in execute' /usr/share/gems/gems/rake-10.0.4/lib/rake/task.rb:184:inblock in invoke_with_call_chain'
    /usr/share/ruby/monitor.rb:211:in mon_synchronize' /usr/share/gems/gems/rake-10.0.4/lib/rake/task.rb:177:ininvoke_with_call_chain'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/task.rb:170:in invoke' /usr/share/gems/gems/rake-10.0.4/lib/rake/application.rb:143:ininvoke_task'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/application.rb:101:in block (2 levels) in top_level' /usr/share/gems/gems/rake-10.0.4/lib/rake/application.rb:101:ineach'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/application.rb:101:in block in top_level' /usr/share/gems/gems/rake-10.0.4/lib/rake/application.rb:110:inrun_with_threads'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/application.rb:95:in top_level' /usr/share/gems/gems/rake-10.0.4/lib/rake/application.rb:73:inblock in run'
    /usr/share/gems/gems/rake-10.0.4/lib/rake/application.rb:160:in standard_exception_handling' /usr/share/gems/gems/rake-10.0.4/lib/rake/application.rb:70:inrun'
    /usr/share/gems/gems/rake-10.0.4/bin/rake:33:in <top (required)>' /usr/bin/rake:23:inload'
    /usr/bin/rake:23:in `'
    Tasks: TOP => test

I hope you can help me with these output and/or supply me with a patch (or new release).

For your convinience I uploaded some more verbose stuff to http://besser82.fedorapeople.org/rubygem-posix-spawn_results.tar.xz

If you need some Fedora chroot you can fetch them here:

64-Bit: http://besser82.fedorapeople.org/fedora-20-x86_64.tar.xz
32-Bit: http://besser82.fedorapeople.org/fedora-20-i686.tar.xz

Cheers,
besser82

0.3.6 Broken on Mac

0.3.6 is broken on mac with the following error:

Installing gem posix-spawn-0.3.6
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/.gitignore
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/COPYING
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/Gemfile
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/HACKING
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/README.md
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/Rakefile
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/TODO
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/bin/posix-spawn-benchmark
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/ext/extconf.rb
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/ext/posix-spawn.c
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/lib/posix-spawn.rb
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/lib/posix/spawn.rb
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/lib/posix/spawn/version.rb
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/posix-spawn.gemspec
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/test/test_backtick.rb
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/test/test_child.rb
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/test/test_popen.rb
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/test/test_spawn.rb
/Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/test/test_system.rb
Building native extensions.  This could take a while...
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common  -Wall   -c posix-spawn.c
In file included from posix-spawn.c:14:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0/ruby.h:24:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0/config.h:21:9: warning: '_GNU_SOURCE' macro redefined
#define _GNU_SOURCE 1
        ^
posix-spawn.c:3:9: note: previous definition is here
#define _GNU_SOURCE
        ^
1 warning generated.
In file included from posix-spawn.c:14:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0/ruby.h:24:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0/config.h:21:9: warning: '_GNU_SOURCE' macro redefined
#define _GNU_SOURCE 1
        ^
posix-spawn.c:3:9: note: previous definition is here
#define _GNU_SOURCE
        ^
1 warning generated.
cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o posix_spawn_ext.bundle posix-spawn.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64     -lruby  -lpthread -ldl -lobjc
make "DESTDIR=" install
/usr/bin/install -c -m 0755 posix_spawn_ext.bundle ./.gem.20130723-96852-r47vbj
ERROR:  While executing gem ... (NoMethodError)
    undefined method `join' for nil:NilClass

[macOS] POSIX::Spawn.system stale $? for missing commands

If the command run by POSIX::Spawn.system fails to execute because it was not found (Errno:ENOENT raised by POSIX::Spawn.spawn), the content of the $? global variable is not updated on macOS 10.12.14, which differs from the behavior of Kernel.system which sets $? to an Instance of Process::Status with exitstatus 127.

macOS 10.12.4:

$ ruby -v
ruby 2.2.7p470 (2017-03-28 revision 58194) [x86_64-darwin16]
$ irb
2.2.6 :001 > $?
 => nil
2.2.6 :002 > Kernel.system "foo"
 => nil
2.2.6 :003 > $?
 => #<Process::Status: pid 20175 exit 127>
2.2.6 :004 >
$ irb -r posix/spawn
2.2.6 :001 > $?
 => nil
2.2.6 :002 > POSIX::Spawn.system "foo"
 => false
2.2.6 :003 > $?
 => nil
2.2.6 :004 >

Linux (Debian Jessie):

Status: Downloaded newer image for ruby:2.2
root@0cd5cc5c4feb:/# gem install --no-document posix-spawn
Fetching: posix-spawn-0.3.13.gem (100%)
Building native extensions.  This could take a while...
Successfully installed posix-spawn-0.3.13
1 gem installed
root@0cd5cc5c4feb:/# ruby -v
ruby 2.2.7p470 (2017-03-28 revision 58194) [x86_64-linux]
root@0cd5cc5c4feb:/# irb
irb(main):001:0>
root@0cd5cc5c4feb:/# irb
irb(main):001:0> $?
=> nil
irb(main):002:0> Kernel.system "foo"
=> nil
irb(main):003:0> $?
=> #<Process::Status: pid 38 exit 127>
irb(main):004:0>
root@0cd5cc5c4feb:/# irb -r posix/spawn
irb(main):001:0> $?
=> nil
irb(main):002:0> POSIX::Spawn.system "foo"
=> false
irb(main):003:0> $?
=> #<Process::Status: pid 41 exit 127>
irb(main):004:0>

Note that $? stays nil in the POSIX::Spawn case on macOS.

This issue is loosely related to and was extracted from #81.

spawn.rb:187:in `_pspawn': Invalid command name (ArgumentError)

Hi there,

I just installed git-up as a gem on my new mac (OSX Mountain Lion). Git-up uses posix-spawn as a dependency.

When I execute the git up command, I get the error mentioned in the subject.

I have installed ruby via rvm + gcc for OSX (not the complete XCode tools).

I have used git-up successfully in Ubuntu before. Is there some dependency I must install in OSX for posix-spawn to work properly? Thanks.

Spawn::Child fails on win32 + 1.9.2

Looks like write_nonblock fails, even though write works. Probably a ruby bug.

$ ruby -e ' require "posix-spawn"; puts POSIX::Spawn::Child.new("dir",:input=>"
").out '
c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn/child.rb:179:in `write_nonblock': Bad file descriptor (Errno::EBADF)
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn/child.rb:179:in `block in read_and_write'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn/child.rb:176:in `each'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn/child.rb:176:in `read_and_write'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn/child.rb:108:in `exec!'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn/child.rb:80:in `initialize'
        from -e:1:in `new'
        from -e:1:in `<main>'

$ ruby -ve 'r,w=IO.pipe; Process.spawn("dir", :in => r, :out => "file"); w.write_nonblock("test")'
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
-e:1:in `write_nonblock': Bad file descriptor (Errno::EBADF)
        from -e:1:in `<main>'

Fail fast when the command doesn't exist

I stumbled across this when I was trying to use Albino. It turns out that I didn't have pygments installed (I was sure that I had previously installed it) but the error I was receiving was pretty confusing.

You can replicate the error I was seeing with the following command:

$ ruby -e"require 'rubygems'; require 'posix/spawn'; POSIX::Spawn::Child.new('non-existent-command')"
/Users/chrisroos/.rvm/gems/ree-1.8.7-2010.01/gems/posix-spawn-0.3.5/lib/posix/spawn.rb:154:in `_pspawn': No such file or directory - posix_spawnp (Errno::ENOENT)
from /Users/chrisroos/.rvm/gems/ree-1.8.7-2010.01/gems/posix-spawn-0.3.5/lib/posix/spawn.rb:154:in `pspawn'
from /Users/chrisroos/.rvm/gems/ree-1.8.7-2010.01/gems/posix-spawn-0.3.5/lib/posix/spawn.rb:137:in `spawn'
from /Users/chrisroos/.rvm/gems/ree-1.8.7-2010.01/gems/posix-spawn-0.3.5/lib/posix/spawn.rb:274:in `popen4'
from /Users/chrisroos/.rvm/gems/ree-1.8.7-2010.01/gems/posix-spawn-0.3.5/lib/posix/spawn/child.rb:105:in `exec!'
from /Users/chrisroos/.rvm/gems/ree-1.8.7-2010.01/gems/posix-spawn-0.3.5/lib/posix/spawn/child.rb:80:in `initialize'
from -e:1:in `new'
from -e:1

I wonder if it'd be worth/possible to fail fast with a clear error message when the command you're trying to fork to doesn't exist?

0.3.4 release is completely broken on linux

Most of the tests fail due to POSIX_SPAWN_SETSIGDEF in f649812

Started
.FFFFFFFFF.FFFF.FFFFFF...................................EFFF.FFFFFFFFFFFF.FFFFFFFFF.FFFFFF.F.....F.FF
Finished in 0.748392 seconds.

102 tests, 275 assertions, 53 failures, 1 errors

However, when I remove that, the test_max_stubborn_child test hangs on rbx + osx:

Started
..............
^CF.......................................................................................
Finished in 47.334512 seconds.

  1) Failure:
test_max_with_stubborn_child(ChildTest)
    [./test/test_child.rb:72:in `test_max_with_stubborn_child'
     kernel/bootstrap/array.rb:76:in `each'
     kernel/bootstrap/array.rb:76:in `each']:
<POSIX::Spawn::MaximumOutputExceeded> exception expected but was
Class: <Interrupt>
Message: <"Thread has been interrupted">

try to install posix-spawn with JRuby fails

$ gem install  posix-spawn
Building native extensions.  This could take a while...
ERROR:  Error installing posix-spawn:
    ERROR: Failed to build gem native extension.

        /Users/Owen/.rvm/rubies/jruby-1.6.7/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
creating Makefile

make
cc -I. -I/Users/Owen/.rvm/rubies/jruby-1.6.7/lib/native/include -I/Users/Owen/.rvm/rubies/jruby-1.6.7/lib/native/include/ruby -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE      -fPIC -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions   -Wall   -arch i386 -c posix-spawn.c
cc -dynamic -bundle -undefined dynamic_lookup  -o posix_spawn_ext.bundle posix-spawn.o -L"." -L"/Users/Owen/.rvm/rubies/jruby-1.6.7/lib" -bundle -framework JavaVM -Wl,-syslibroot, -mmacosx-version-min=10.5   -arch i386  
ld: library not found for -lbundle1.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [posix_spawn_ext.bundle] Error 1


Gem files will remain installed in /Users/Owen/.rvm/gems/jruby-1.6.7/gems/posix-spawn-0.3.6 for inspection.
Results logged to /Users/Owen/.rvm/gems/jruby-1.6.7/gems/posix-spawn-0.3.6/ext/gem_make.out
$ ruby -v
jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (Java HotSpot(TM) Client VM 1.6.0_29) [darwin-i386-java]

I don't have the same problem with MRI-1.9.3-p125

EventMachine hooks

I created code for an EM-aware POSIX::Spawn::Child. It passes the same tests as the blocking version, albeit with #callback and #errback instead of return/raise. Do you think it would be a good idea to smooth it out and import it into this repo, to make sure its interface/features/tests stay in sync with that of POSIX::Spawn::Child? I can send a pull request if so.

Thanks!

Rake uses depreacated tasks

When running rake tasks you will receive a warning message:

$ rake test
rake/gempackagetask is deprecated.  Use rubygems/package_task instead
rake aborted!
cannot load such file -- rake/extensiontask

(See full trace by running task with --trace)

push tags to github

When you tag releases, would you mind pushing the tags to GitHub? For example the latest version on Rubygems.org is 0.3.8, but the v0.3.8 tag is missing from the repository.

Bug with out encoding in Cygwin

Cygwin 2.0.4(0.287/5/3) 2015-06-09 12:20 i686

POSIX::Spawn::VERSION => "0.3.13"

I have a directory tree which has Russian names.

Calling system 'ls -la' returns:

drwxrwxr-x+ 1 vlv Пользователи домена   0 апр 26 15:28 .
drwxrwx---+ 1 vlv Пользователи домена   0 апр 26 12:47 ..
drwxrwxr-x+ 1 vlv Пользователи домена   0 апр 26 15:28 .git
-rw-rwxr--+ 1 vlv Пользователи домена 401 апр 26 15:28 home.md
drwxrwxr-x+ 1 vlv Пользователи домена   0 апр 26 15:21 Прикладные-объекты
drwxrwxr-x+ 1 vlv Пользователи домена   0 апр 26 15:17 Справочники

But calling POSIX::Spawn::Child.new('ls', '-la').out returns:

] pry(#<Grit::Git>)> POSIX::Spawn::Child.new('ls', '-la').out
=> "\xD0\xB8\xD1\x82\xD0\xBE\xD0\xB3\xD0\xBE 1\ndrwxrwxr-x+ 1 vlv \xD0\x9F\xD0\xBE\xD0\xBB\xD1\x8C\xD0\xB7\xD0\xBE\xD0\xB2\xD0\xB0\xD1\x82\xD0\xB5\xD0\xBB\xD0\xB8 \xD0\xB4\xD0\xBE\xD0\xBC\xD0\xB5\xD0\xBD\xD0\xB0   0 \xD0\xB0\xD0\xBF\xD1\x80 26 15:28 .\ndrwxrwx---+ 1 vlv \xD0\x9F\xD0\xBE\xD0\xBB\xD1\x8C\xD0\xB7\xD0\xBE\xD0\xB2\xD0\xB0\xD1\x82\xD0\xB5\xD0\xBB\xD0\xB8 \xD0\xB4\xD0\xBE\xD0\xBC\xD0\xB5\xD0\xBD\xD0\xB0   0 \xD0\xB0\xD0\xBF\xD1\x80 26 12:47 ..\ndrwxrwxr-x+ 1 vlv \xD0\x9F\xD0\xBE\xD0\xBB\xD1\x8C\xD0\xB7\xD0\xBE\xD0\xB2\xD0\xB0\xD1\x82\xD0\xB5\xD0\xBB\xD0\xB8 \xD0\xB4\xD0\xBE\xD0\xBC\xD0\xB5\xD0\xBD\xD0\xB0   0 \xD0\xB0\xD0\xBF\xD1\x80 26 15:28 .git\n-rw-rwxr--+ 1 vlv \xD0\x9F\xD0\xBE\xD0\xBB\xD1\x8C\xD0\xB7\xD0\xBE\xD0\xB2\xD0\xB0\xD1\x82\xD0\xB5\xD0\xBB\xD0\xB8 \xD0\xB4\xD0\xBE\xD0\xBC\xD0\xB5\xD0\xBD\xD0\xB0 401 \xD0\xB0\xD0\xBF\xD1\x80 26 15:28 home.md\ndrwxrwxr-x+ 1 vlv \xD0\x9F\xD0\xBE\xD0\xBB\xD1\x8C\xD0\xB7\xD0\xBE\xD0\xB2\xD0\xB0\xD1\x82\xD0\xB5\xD0\xBB\xD0\xB8 \xD0\xB4\xD0\xBE\xD0\xBC\xD0\xB5\xD0\xBD\xD0\xB0   0 \xD0\xB0\xD0\xBF\xD1\x80 26 15:21 \xD0\x9F\xD1\x80\xD0\xB8\xD0\xBA\xD0\xBB\xD0\xB0\xD0\xB4\xD0\xBD\xD1\x8B\xD0\xB5-\xD0\xBE\xD0\xB1\xD1\x8A\xD0\xB5\xD0\xBA\xD1\x82\xD1\x8B\ndrwxrwxr-x+ 1 vlv \xD0\x9F\xD0\xBE\xD0\xBB\xD1\x8C\xD0\xB7\xD0\xBE\xD0\xB2\xD0\xB0\xD1\x82\xD0\xB5\xD0\xBB\xD0\xB8 \xD0\xB4\xD0\xBE\xD0\xBC\xD0\xB5\xD0\xBD\xD0\xB0   0 \xD0\xB0\xD0\xBF\xD1\x80 26 15:17 \xD0\xA1\xD0\xBF\xD1\x80\xD0\xB0\xD0\xB2\xD0\xBE\xD1\x87\xD0\xBD\xD0\xB8\xD0\xBA\xD0\xB8\n"
 POSIX::Spawn::Child.new('ls', '-la').out.encoding => #<Encoding:ASCII-8BIT>

It will be cause of problem:

"#{POSIX::Spawn::Child.new('ls', '-la').out} текст по Русски"
Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8

Thx

gem check posix-spawn has problems

How can I fix this ? :

posix-spawn-0.3.13.gem has 5 problems
ext/.RUBYARCHDIR.time:
Extra file
ext/Makefile:
Extra file
ext/posix-spawn.o:
Extra file
ext/posix_spawn_ext.so:
Extra file
lib/posix_spawn_ext.so:
Extra file

Install on Mountain Lion fails

posix-spawn 0.3.6 seems to rely on /usr/bin/gcc-4.2

This path does not exist on OS X Mountain Lion, even though XCode is installed.

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

The symlink fixes the problem locally.

unsetenv_others => true should not need a environment to work

On 1.9:
spawn('env', :unsetenv_others => true)
will unset all the environment variables.

Posix::Spawn::spawn('env', :unsetenv_others => true} does not unset all the variables. Looking at the C, you only test for the variable if an ENV is passed in. I'm not savvy enough to provide a patch. As a workaround you can pass in a hash with a dummy key (an empty hash also does not clear the environment, which should probably be another test case.)

Ubuntu 12.04, Ruby 2.0.0-p247, RubyGems 1.8.25: posix_spawn_ext not built correctly

Running Ruby 2.0.0-p247:

$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]

On an Ubuntu 12.04 system:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:    12.04
Codename:   precise

posix-spawn v3.0.6 installed successfully but trying to require it reports it can't load posix_spawn_ext:

$ ruby -e "require 'posix-spawn'"
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require': cannot load such file -- posix_spawn_ext (LoadError)
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require'
  from /usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:2:in `<top (required)>'
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require'
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require'
  from /usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems/posix-spawn-0.3.6/lib/posix-spawn.rb:1:in `<top (required)>'
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:60:in `require'
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:60:in `rescue in require'
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:35:in `require'
  from -e:1:in `<main>'

There appear to be two posix_spawn_ext shared libraries compiled -- but one is in a very strange location:

$ find /usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems -name 'posix_spawn_ext*'
/usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems/posix-spawn-0.3.6/ext/posix_spawn_ext.so
/usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems/posix-spawn-0.3.6/lib/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/x86_64-linux/posix_spawn_ext.so

I can uninstall and re-install posix-spawn and see the same behavior:

$ gem uninstall posix-spawn

You have requested to uninstall the gem:
    posix-spawn-0.3.6
gitlab-grit-2.6.0 depends on [posix-spawn (~> 0.3.6)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  Y
Remove executables:
    posix-spawn-benchmark

in addition to the gem? [Yn]  Y
Removing posix-spawn-benchmark
Successfully uninstalled posix-spawn-0.3.6

$ find /usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems -name 'posix_spawn_ext*'

$ gem install posix-spawn
Fetching: posix-spawn-0.3.6.gem (100%)
Building native extensions.  This could take a while...
Successfully installed posix-spawn-0.3.6
1 gem installed
Installing ri documentation for posix-spawn-0.3.6...
unable to convert "\xF8" from ASCII-8BIT to UTF-8 for lib/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/x86_64-linux/posix_spawn_ext.so, skipping
Installing RDoc documentation for posix-spawn-0.3.6...
unable to convert "\xF8" from ASCII-8BIT to UTF-8 for lib/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/x86_64-linux/posix_spawn_ext.so, skipping

$ find /usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems -name 'posix_spawn_ext*'
/usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems/posix-spawn-0.3.6/ext/posix_spawn_ext.so
/usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems/posix-spawn-0.3.6/lib/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/x86_64-linux/posix_spawn_ext.so

$ ruby -e "require 'posix-spawn'"
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require': cannot load such file -- posix_spawn_ext (LoadError)
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require'
  from /usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:2:in `<top (required)>'
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require'
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require'
  from /usr/local/rvm/gems/ruby-2.0.0-p247@lab/gems/posix-spawn-0.3.6/lib/posix-spawn.rb:1:in `<top (required)>'
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:60:in `require'
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:60:in `rescue in require'
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:35:in `require'
  from -e:1:in `<main>'

`gem install posix-spawn` works, vendored `bundle` does not

Command rm -rf vendor/bundle vendor/cache .bundle && bundle --path vendor/bundle --binstubs vendor/bundle/bin

Installing posix-spawn (0.3.6)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/users/.rbenv/versions/1.9.3-p392/bin/ruby extconf.rb --with-ldflags=\"-L/usr/lib\
creating Makefile

make
compiling posix-spawn.c
In file included from /Users/users/.rbenv/versions/1.9.3-p392/include/ruby-1.9.1/ruby/ruby.h:24,
                 from /Users/users/.rbenv/versions/1.9.3-p392/include/ruby-1.9.1/ruby.h:32,
                 from posix-spawn.c:14:
/Users/users/.rbenv/versions/1.9.3-p392/include/ruby-1.9.1/x86_64-darwin11.4.2/ruby/config.h:17:1: warning: "_GNU_SOURCE" redefined
posix-spawn.c:3:1: warning: this is the location of the previous definition
linking shared-object posix_spawn_ext.bundle
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [posix_spawn_ext.bundle] Error 2


Gem files will remain installed in /Users/users/projects/tasks/vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6 for inspection.
Results logged to /Users/users/projects/tasks/vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/ext/gem_make.out
ᐅ ruby -e 'puts RUBY_DESCRIPTION'
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin11.4.2]
ᐅ gem list

*** LOCAL GEMS ***

bundler (1.3.4)
ᐅ xcode-select -version
xcode-select version 2308.
ᐅ
# Gemfile
source 'https://rubygems.org'

ruby '1.9.3'

gem 'pg' # another gem with native extensions that installs successfully
gem 'posix-spawn' 

Also tried gem install posix-spawn before bundling, and bundle package --all and deprecated bundle cache --all to no avail.

Suggestions?

better api for 1.8

the Posix.spawn compatibility is great, but the api is a pain to use on 1.8.

we can probably support a simpler spawn(env, cmd, opts) style on 1.8 (instead of the current spawn(env, *(cmd + [opts]))) while still maintaining compatibility with 1.9.

Posix-spawn failed to build on OS X 10.9 with Xcode 5.1 installed

While attempting to build posix-spawn on OS X 10.9 with Xcode 5.1 (release) the following error is faced:

linking shared-object posix_spawn_ext.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [posix_spawn_ext.bundle] Error 1
ERROR:  Error installing git-up:
    ERROR: Failed to build gem native extension.

    Building has failed. See above output for more information on the failure.

Apparently this is due to the new behaviour of clang in the latest Xcode. As described in this SO question: http://stackoverflow.com/questions/22352838/ruby-gem-install-json-fails-on-mavericks-and-xcode-5-1-unknown-argument-mul, the root cause is that the clang treats unknown compiler options as error.

Test failure on Gentoo Linux with Ruby 1.8.7

  1) Failure:
test_spawn_close_invalid_fd_raises_exception(PosixSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:119:in `test_spawn_close_invalid_fd_raises_exception']:
<127> expected but was
<0>.

102 tests, 320 assertions, 1 failures, 0 errors
rake aborted!
Command failed with status (1): [/usr/bin/ruby18 -I"lib" "/usr/lib64/ruby/g...]

posix_spawn_ext.so: undefined symbol: rb_fix2int

I am trying to get Gitlab CE 8.5.8+dfsg-5 working on Ubuntu 16.04 32 bit, using the package in the "universe" repo. That GitLab package installs latest posix_spawn as part of it's install. 0.3.13 causes this error to be raised (in the sidekiq log):

posix_spawn_ext.so: undefined symbol: rb_fix2int

0.3.11 does not appear to have this issue. I have not tried 0.3.12.
ruby 2.3.1p112 (2016-04-26) [i386-linux-gnu]
Ubuntu 16.04.2 LTS
Linux 4.4.50-rh54-20170220215556.xenU.i386 #1 SMP Mon Feb 20 22:04:23 UTC 2017 i686 i686 i686 GNU/Linux

Why switch interpreters for cygwin?

I'm trying to use https://github.com/aanand/git-up under cygwin and logged an issue there #77, but it's probably a posix-spawn issue.

Why does line 503 swap out the windows COMSPEC for the cygwin main shell? cygwin is already posix like and has /bin/sh & /bin/bash. I tried a simple variable setting: COMSPEC=/bin/bash, but that fails trying to append and run commands with /c instead of -c.

Overall cygwin is probably going to be goofy here. If you're running a ruby that was installed under cygwin as a cygwin package it should use /bin/sh. But maybe if you're running the native windows version of ruby and invoking it from within a cygwin shell, it's appropriate to use the windows launcher cmd.exe?

Fetching origin
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 11 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (11/11), done.
From github.com:account/repo
   e1e886f..fdfb95f  master     -> origin/master
current.branchname               fast-forwarding...
/home/me-user/.gem/ruby/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164:in `spawn': No such file or directory - C:\Windows\system32\cmd.exe (Errno::ENOENT)
        from /home/me-user/.gem/ruby/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164:in `spawn'
        from /home/me-user/.gem/ruby/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:311:in `popen4'
        from /home/me-user/.gem/ruby/gems/posix-spawn-0.3.9/lib/posix/spawn/child.rb:141:in `exec!'
        from /home/me-user/.gem/ruby/gems/posix-spawn-0.3.9/lib/posix/spawn/child.rb:91:in `initialize'
        from /home/me-user/.gem/ruby/gems/grit-2.5.0/lib/grit/git.rb:454:in `new'
        from /home/me-user/.gem/ruby/gems/grit-2.5.0/lib/grit/git.rb:454:in `sh'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:225:in `rebase'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:130:in `block in rebase_all_branches'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:97:in `each'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:97:in `rebase_all_branches'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:22:in `block (3 levels) in run'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:199:in `returning_to_current_branch'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:21:in `block (2 levels) in run'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:183:in `with_stash'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:20:in `block in run'
        from /home/me-user/.gem/ruby/gems/grit-2.5.0/lib/grit/git.rb:90:in `with_timeout'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:19:in `run'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/bin/git-up:5:in `<top (required)>'
        from /home/me-user/bin/git-up:23:in `load'
        from /home/me-user/bin/git-up:23:in `<main>'

gcc error while installing gem on 32bit OS

Unable to install this gem on one of my 32bit server and running with RHEL5.9

[root@server-test1 ~]# /usr/bin/gem install posix-spawn-0.3.11.gem
Building native extensions. This could take a while...
ERROR: Error installing posix-spawn-0.3.11.gem:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -I. -D_FILE_OFFSET_BITS=64 -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -fno-strict-aliasing -fPIC -Wall -c posix-spawn.c
cc1: error: unrecognized command line option "-fstack-protector"
cc1: error: invalid parameter `ssp-buffer-size'
posix-spawn.c:1: error: bad value (generic) for -mtune= switch
make: *** [posix-spawn.o] Error 1

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/posix-spawn-0.3.11 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/posix-spawn-0.3.11/ext/gem_make.out
[root@server-test1 ~]
[root@server-test1 ~] arch
i686
[root@server-test1 ~]

POSIX::Spawn.` slower than Kernel.` on MRI 2.2

I noticed that posix-spawn's implementation of the back-tick operator is significantly slower than the built-in implementation of MRI ruby 2.2.2 on both Linux and Mac OS X:

require "benchmark"
require "posix/spawn"
n = 10_000
cmd = "/bin/echo".freeze
Benchmark.bm do |x|
  x.report("Kernel.\`")       { n.times { Kernel.`       cmd } }
  x.report("POSIX::Spawn.\`") { n.times { POSIX::Spawn.` cmd } }
end

Result on Mac OS X 10.11 Beta 6, Darwin 15.0.0 x86_64, ruby 2.2.2p133, posix-spawn 0.3.11:

                    user     system      total        real
Kernel.`        0.800000   5.470000  42.220000 ( 42.443894)
POSIX::Spawn.` 14.350000   2.440000 100.060000 (102.485969)

Result on Ubuntu Server 14.04.3 LTS, Linux 3.13.0 x86_64, ruby 2.2.2p95, posix-spawn 0.3.11:

                    user     system      total        real
Kernel.`        1.080000   0.810000  18.140000 ( 17.168791)
POSIX::Spawn.`  1.440000   1.030000  34.150000 ( 32.650234)

Spawn::Child should support encodings properly under 1.9

Right now we're forcing the encoding of the input string to BINARY and also setting the output streams to BINARY for reads. See:

af16f2a

To be consistent with Ruby's core IO methods we'd need to.

  1. Accept input in any encoding and transcode to Encoding::default_external or a user-specified external encoding when writing to the stdin fd.
  2. Read data off of the stdout/stderr assuming the default Encoding::default_external or user-specified external_encoding and transcode to the Encoding::internal_encoding.
  3. Add support for overriding the default external/internal encodings as options to Child::new.

One weird thing I noticed when working on this previously is that IO#readpartial and IO#write_nonblock seem to ignore the IO object's encoding, unlike the IO#read and IO#write methods. We get BINARY encoded data out no matter what the external/internal encoding is set to. Something to look into when we fix this.

add jruby support

definitely need this before 1.0

with the new cext support in 1.6, the extension actually compiles and works. we'll need to fallback to a pure jruby implementation if you try to pass fds through, but any simple usage can probably use the cext directly.

i also found a way to get exit status out of IO.popen4 on jruby: http://jira.codehaus.org/browse/JRUBY-5684

Posix-spawn won't compile under Cygwin w/ Ruby 1.9.3-p0

I hope this is the appropriate spot for this. I know Windows support is low on the pole, and it's understandable. If there is some part of the M I need to RTF, please let me know.

Below is the result of my invoking "gem install jekyll" with Ruby 1.9.2 installed in Cygwin on WinXP. I ran into this same issue when using the Cygwin-default Ruby 1.8.x, but even upon uninstalling this and compiling Ruby 1.9.3-p0 I get the same error. I mention this because in my research I came across some discussion pointing to a difference in how 1.8 and 1.9 handled posix-spawn.

This is the content of gem-make.out. Thank you for any help you can provide.

creating Makefile

make
compiling posix-spawn.c
posix-spawn.c:9:19: spawn.h: No such file or directory
In file included from /usr/local/include/ruby-1.9.1/ruby/ruby.h:24,
                 from /usr/local/include/ruby-1.9.1/ruby.h:32,
                 from posix-spawn.c:14:
/usr/local/include/ruby-1.9.1/i386-cygwin/ruby/config.h:17:1: warning: "_GNU_SOURCE" redefined
posix-spawn.c:3:1: warning: this is the location of the previous definition
posix-spawn.c:103: error: parse error before "posix_spawn_file_actions_t"
posix-spawn.c: In function `posixspawn_file_actions_addclose':
posix-spawn.c:108: error:`val' undeclared (first use in this function)
posix-spawn.c:108: error: (Each undeclared identifier is reported only once
posix-spawn.c:108: error: for each function it appears in.)
posix-spawn.c:111: error: `key' undeclared (first use in this function)
posix-spawn.c:113: warning: implicit declaration of function`posix_spawn_file_actions_addclose'
posix-spawn.c:113: error: `fops' undeclared (first use in this function)
posix-spawn.c: At top level:
posix-spawn.c:129: error: parse error before "posix_spawn_file_actions_t"
posix-spawn.c: In function`posixspawn_file_actions_adddup2':
posix-spawn.c:133: error: `key' undeclared (first use in this function)
posix-spawn.c:137: error:`val' undeclared (first use in this function)
posix-spawn.c:141: warning: implicit declaration of function `posix_spawn_file_actions_adddup2'
posix-spawn.c:141: error:`fops' undeclared (first use in this function)
posix-spawn.c: At top level:
posix-spawn.c:155: error: parse error before "posix_spawn_file_actions_t"
posix-spawn.c: In function `posixspawn_file_actions_addopen':
posix-spawn.c:162: error:`key' undeclared (first use in this function)
posix-spawn.c:166: error: `val' undeclared (first use in this function)
posix-spawn.c:173: warning: implicit declaration of function`posix_spawn_file_actions_addopen'
posix-spawn.c:173: error: `fops' undeclared (first use in this function)
posix-spawn.c: At top level:
posix-spawn.c:186: error: parse error before "posix_spawn_file_actions_t"
posix-spawn.c: In function`posixspawn_file_actions_operations_iter':
posix-spawn.c:190: error: `key' undeclared (first use in this function)
posix-spawn.c:190: error:`val' undeclared (first use in this function)
posix-spawn.c:190: error: `fops' undeclared (first use in this function)
posix-spawn.c: At top level:
posix-spawn.c:210: error: parse error before '*' token
posix-spawn.c: In function`posixspawn_file_actions_init':
posix-spawn.c:212: warning: implicit declaration of function `posix_spawn_file_actions_init'
posix-spawn.c:212: error:`fops' undeclared (first use in this function)
posix-spawn.c:213: error: `options' undeclared (first use in this function)
posix-spawn.c: At top level:
posix-spawn.c:230: error: parse error before "posix_spawnattr_t"
posix-spawn.c: In function`posixspawn_set_pgroup':
posix-spawn.c:233: error: `options' undeclared (first use in this function)
posix-spawn.c:237: error:`pflags' undeclared (first use in this function)
posix-spawn.c:237: error: `POSIX_SPAWN_SETPGROUP' undeclared (first use in this function)
posix-spawn.c:238: warning: implicit declaration of function`posix_spawnattr_setpgroup'
posix-spawn.c:238: error: `pattr' undeclared (first use in this function)
posix-spawn.c: In function`rb_posixspawn_pspawn':
posix-spawn.c:330: error: `posix_spawn_file_actions_t' undeclared (first use in this function)
posix-spawn.c:330: error: parse error before "fops"
posix-spawn.c:331: error:`posix_spawnattr_t' undeclared (first use in this function)
posix-spawn.c:341: warning: ISO C90 forbids mixed declarations and code
posix-spawn.c:381: warning: ISO C90 forbids mixed declarations and code
posix-spawn.c:391: error: `fops' undeclared (first use in this function)
posix-spawn.c:392: warning: implicit declaration of function`posix_spawnattr_init'
posix-spawn.c:392: error: `attr' undeclared (first use in this function)
posix-spawn.c:395: error:`POSIX_SPAWN_SETSIGMASK' undeclared (first use in this function)
posix-spawn.c:397: warning: implicit declaration of function `posix_spawnattr_setsigmask'
posix-spawn.c:409: warning: implicit declaration of function`posix_spawnattr_setflags'
posix-spawn.c:418: warning: implicit declaration of function `posix_spawnp'
posix-spawn.c:427: warning: implicit declaration of function`posix_spawn_file_actions_destroy'
posix-spawn.c:428: warning: implicit declaration of function `posix_spawnattr_destroy'
Makefile:199: recipe for target`posix-spawn.o' failed
make: **\* [posix-spawn.o] Error 1

posix-spawn-0.3.8 fails to build with Alpine Linux and musl libc

Building native extensions.  This could take a while...
/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
compiling posix-spawn.c
In file included from /usr/include/ruby-2.0.0/ruby/ruby.h:24:0,
                 from /usr/include/ruby-2.0.0/ruby.h:33,
                 from posix-spawn.c:14:
/usr/include/ruby-2.0.0/x86_64-linux-musl/ruby/config.h:17:0: warning: "_GNU_SOURCE" redefined [enabled by default]
 #define _GNU_SOURCE 1
 ^
posix-spawn.c:3:0: note: this is the location of the previous definition
 #define _GNU_SOURCE
 ^
posix-spawn.c: In function 'rb_posixspawn_pspawn':
posix-spawn.c:403:11: error: 'POSIX_SPAWN_USEVFORK' undeclared (first use in this function)
  flags |= POSIX_SPAWN_USEVFORK;
           ^
posix-spawn.c:403:11: note: each undeclared identifier is reported only once for each function it appears in
Makefile:223: recipe for target 'posix-spawn.o' failed
make: *** [posix-spawn.o] Error 1
ERROR:  Error installing /home/ncopa/aports/wip/ruby-posix-spawn/src/posix-spawn-0.3.8.gem:
    ERROR: Failed to build gem native extension.

    Building has failed. See above output for more information on the failure.

btw, why are the no git tag for 0.3.8 in https://github.com/rtomayko/posix-spawn/releases ?

test failures on ubuntu systems using dash

vagrant@vagrantup:~/code/posix-spawn$ ls -alh /bin/sh
lrwxrwxrwx 1 root root 4 2010-07-20 23:02 /bin/sh -> dash

vagrant@vagrantup:~/code/posix-spawn$ rake
(in /home/vagrant/code/posix-spawn)
cp tmp/x86_64-linux/posix_spawn_ext/1.8.7/posix_spawn_ext.so lib/posix_spawn_ext.so
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
...F..................exec: 1: 101: not found
FF..FFFFF...........................exec: 1: 101: not found
FF..FFFFF...................................
Finished in 1.347913 seconds.

  1) Failure:
test_backtick_redirect(BacktickTest) [./test/test_backtick.rb:27]:
<"/bin/sh: nosuchcmd: not found\n"> expected but was
<"/bin/sh: nosuchcmd: command not found\n">.

  2) Failure:
test_explicitly_passing_an_fd_as_open(ForkSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:325:in `assert_process_exit_ok'
     ./test/test_spawn.rb:185:in `test_explicitly_passing_an_fd_as_open']:
<0> expected but was
<2>.

  3) Failure:
test_sanity_of_checking_clone_with_sh(ForkSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:72:in `test_sanity_of_checking_clone_with_sh']:
<0> expected but was
<2>.

  4) Failure:
test_spawn_close_on_standard_stream_io_object(ForkSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:88:in `test_spawn_close_on_standard_stream_io_object']:
<1> expected but was
<2>.

  5) Failure:
test_spawn_close_option_with_fd_number(ForkSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:98:in `test_spawn_close_option_with_fd_number']:
<1> expected but was
<2>.

  6) Failure:
test_spawn_close_option_with_io_object(ForkSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:109:in `test_spawn_close_option_with_io_object']:
<1> expected but was
<2>.

  7) Failure:
test_spawn_close_option_with_symbolic_standard_stream_names(ForkSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:79:in `test_spawn_close_option_with_symbolic_standard_stream_names']:
<1> expected but was
<2>.

  8) Failure:
test_spawn_closing_multiple_fds_with_array_keys(ForkSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:127:in `test_spawn_closing_multiple_fds_with_array_keys']:
<1> expected but was
<2>.

  9) Failure:
test_explicitly_passing_an_fd_as_open(PosixSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:325:in `assert_process_exit_ok'
     ./test/test_spawn.rb:185:in `test_explicitly_passing_an_fd_as_open']:
<0> expected but was
<2>.

 10) Failure:
test_sanity_of_checking_clone_with_sh(PosixSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:72:in `test_sanity_of_checking_clone_with_sh']:
<0> expected but was
<2>.

 11) Failure:
test_spawn_close_on_standard_stream_io_object(PosixSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:88:in `test_spawn_close_on_standard_stream_io_object']:
<1> expected but was
<2>.

 12) Failure:
test_spawn_close_option_with_fd_number(PosixSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:98:in `test_spawn_close_option_with_fd_number']:
<1> expected but was
<2>.

 13) Failure:
test_spawn_close_option_with_io_object(PosixSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:109:in `test_spawn_close_option_with_io_object']:
<1> expected but was
<2>.

 14) Failure:
test_spawn_close_option_with_symbolic_standard_stream_names(PosixSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:79:in `test_spawn_close_option_with_symbolic_standard_stream_names']:
<1> expected but was
<2>.

 15) Failure:
test_spawn_closing_multiple_fds_with_array_keys(PosixSpawnTest)
    [./test/test_spawn.rb:332:in `assert_process_exit_status'
     ./test/test_spawn.rb:127:in `test_spawn_closing_multiple_fds_with_array_keys']:
<1> expected but was
<2>.

102 tests, 298 assertions, 15 failures, 0 errors
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.8 -I"lib" "/usr/lib/ruby/ge...]

(See full trace by running task with --trace)

posix-spawn 0.3.9 is not compatible with ruby 1.8

It looks like after the update to 0.3.9 posix-spawn stopped working under ruby 1.8.
Running rake test gives the following under ruby 1.8.7

cp lib/posix/spawn.rb tmp/x86_64-linux/stage/lib/posix/spawn.rb
install -c tmp/x86_64-linux/posix_spawn_ext/1.8.7/posix_spawn_ext.so lib/posix_spawn_ext.so
cp tmp/x86_64-linux/posix_spawn_ext/1.8.7/posix_spawn_ext.so tmp/x86_64-linux/stage/lib/posix_spawn_ext.so
./lib/posix-spawn.rb:1:in require': ./lib/posix/spawn.rb:243: syntax error, unexpected tSYMBEG, expecting tAMPER (SyntaxError) ::Kernel::exec(*argv, :close_others=>false) ^ ./lib/posix/spawn.rb:274: syntax error, unexpected tIDENTIFIER, expecting tAMPER ...(*system_command_prefixes, cmd, :out => w, r => :close) ^ ./lib/posix/spawn.rb:274: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' ...command_prefixes, cmd, :out => w, r => :close) ^ ./lib/posix/spawn.rb:274: syntax error, unexpected tASSOC, expecting '=' ...prefixes, cmd, :out => w, r => :close) ^ ./lib/posix/spawn.rb:526: syntax error, unexpected ',', expecting ']' [*system_command_prefixes, args[0]] ^ ./lib/posix/spawn.rb:526: syntax error, unexpected ']', expecting kEND from ./lib/posix-spawn.rb:1 from /home/drobinson/posix-spawn/test/test_backtick.rb:2:inrequire'
from /home/drobinson/posix-spawn/test/test_backtick.rb:2
from /usr/lib/ruby/gems/1.8/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:15:in require' from /usr/lib/ruby/gems/1.8/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:15 from /usr/lib/ruby/gems/1.8/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:4:inselect'
from /usr/lib/ruby/gems/1.8/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:4
rake aborted!
Command failed with status (1): [ruby -I"lib" -I"/usr/lib/ruby/gems/1.8/gems/rake-10.3.2/lib" "/usr/lib/ruby/gems/1.8/gems/rake-10.3.2/lib/rake/rake_test_loader.rb" "test/test_backtick.rb" "test/test_child.rb" "test/test_popen.rb" "test/test_spawn.rb" "test/test_system.rb" ]

Tasks: TOP => test
(See full trace by running task with --trace)

I don't get any problems under ruby 1.9.3
If removing support for ruby 1.8 is intentional/acceptable then it would be worth at least updating the Gemfile /docs.

Misuse of shell builtins (?)

Hi,

All tests relying on exec seem failing under standard *nix config (cfr. http://travis-ci.org/#!/blambeau/posix-spawn) Typical example:

pid = _spawn('exec 2>/dev/null 101>&1 102>&2 || exit 1', :out => :close, :err => :close)
assert_process_exit_status pid, 1

which results in an exit status of 2 (misuse of shell builtins), not 1. I must confess that I'm not sure to understand what the test above is supposed to test (that out cannot be redirected? or err? or both?).

Any hint on this?

no /bin/sh on win32

$ ruby -e ' require "posix-spawn"; puts POSIX::Spawn::Child.new("wc -l").out '
c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn.rb:162:i
n `spawn': No such file or directory - /bin/sh (Errno::ENOENT)
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn.rb:162:in `spawn'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn.rb:307:in `popen4'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn/child.rb:105:in `exec!'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.5.2/lib/posix/spawn/child.rb:80:in `initialize'
        from -e:1:in `new'
        from -e:1:in `<main>'

1.9 uses some hacks internally that we should probably copy instead of always calling /bin/sh

Does not compile on OpenBSD

Probably caused by the lack of spawn.h in OpenBSD

[ will on charmeleon ] ( blog ) % gem install jekyll
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

        /home/will/.rvm/rubies/ruby-1.9.3-preview1/bin/ruby extconf.rb
creating Makefile

make
compiling posix-spawn.c
posix-spawn.c:9:19: error: spawn.h: No such file or directory
In file included from /home/will/.rvm/rubies/ruby-1.9.3-preview1/include/ruby-1.9.1/ruby/ruby.h:24,
                 from /home/will/.rvm/rubies/ruby-1.9.3-preview1/include/ruby-1.9.1/ruby.h:32,
                 from posix-spawn.c:14:
/home/will/.rvm/rubies/ruby-1.9.3-preview1/include/ruby-1.9.1/i386-openbsd5.0/ruby/config.h:17:1: warning: "_GNU_SOURCE" redefined
posix-spawn.c:3:1: warning: this is the location of the previous definition
posix-spawn.c:103: error: expected declaration specifiers or '...' before 'posix_spawn_file_actions_t'
posix-spawn.c: In function 'posixspawn_file_actions_addclose':
posix-spawn.c:113: warning: implicit declaration of function 'posix_spawn_file_actions_addclose'
posix-spawn.c:113: error: 'fops' undeclared (first use in this function)
posix-spawn.c:113: error: (Each undeclared identifier is reported only once
posix-spawn.c:113: error: for each function it appears in.)
posix-spawn.c: At top level:
posix-spawn.c:129: error: expected declaration specifiers or '...' before 'posix_spawn_file_actions_t'
posix-spawn.c: In function 'posixspawn_file_actions_adddup2':
posix-spawn.c:141: warning: implicit declaration of function 'posix_spawn_file_actions_adddup2'
posix-spawn.c:141: error: 'fops' undeclared (first use in this function)
posix-spawn.c: At top level:
posix-spawn.c:155: error: expected declaration specifiers or '...' before 'posix_spawn_file_actions_t'
posix-spawn.c: In function 'posixspawn_file_actions_addopen':
posix-spawn.c:173: warning: implicit declaration of function 'posix_spawn_file_actions_addopen'
posix-spawn.c:173: error: 'fops' undeclared (first use in this function)
posix-spawn.c: At top level:
posix-spawn.c:186: error: expected declaration specifiers or '...' before 'posix_spawn_file_actions_t'
posix-spawn.c: In function 'posixspawn_file_actions_operations_iter':
posix-spawn.c:190: error: 'fops' undeclared (first use in this function)
posix-spawn.c:190: error: too many arguments to function 'posixspawn_file_actions_addclose'
posix-spawn.c:193: error: too many arguments to function 'posixspawn_file_actions_adddup2'
posix-spawn.c:196: error: too many arguments to function 'posixspawn_file_actions_addopen'
posix-spawn.c: At top level:
posix-spawn.c:210: error: expected ')' before '*' token
posix-spawn.c:230: error: expected declaration specifiers or '...' before 'posix_spawnattr_t'
posix-spawn.c: In function 'posixspawn_set_pgroup':
posix-spawn.c:237: error: 'POSIX_SPAWN_SETPGROUP' undeclared (first use in this function)
posix-spawn.c:238: warning: implicit declaration of function 'posix_spawnattr_setpgroup'
posix-spawn.c:238: error: 'pattr' undeclared (first use in this function)
posix-spawn.c: In function 'each_env_check_i':
posix-spawn.c:253: warning: unused parameter 'arg'
posix-spawn.c: In function 'rb_posixspawn_pspawn':
posix-spawn.c:330: error: 'posix_spawn_file_actions_t' undeclared (first use in this function)
posix-spawn.c:330: error: expected ';' before 'fops'
posix-spawn.c:331: error: 'posix_spawnattr_t' undeclared (first use in this function)
posix-spawn.c:331: error: expected ';' before 'attr'
posix-spawn.c:332: warning: ISO C90 forbids mixed declarations and code
posix-spawn.c:341: warning: ISO C90 forbids mixed declarations and code
posix-spawn.c:381: warning: ISO C90 forbids mixed declarations and code
posix-spawn.c:391: warning: implicit declaration of function 'posixspawn_file_actions_init'
posix-spawn.c:391: error: 'fops' undeclared (first use in this function)
posix-spawn.c:392: warning: implicit declaration of function 'posix_spawnattr_init'
posix-spawn.c:392: error: 'attr' undeclared (first use in this function)
posix-spawn.c:395: error: 'POSIX_SPAWN_SETSIGMASK' undeclared (first use in this function)
posix-spawn.c:397: warning: implicit declaration of function 'posix_spawnattr_setsigmask'
posix-spawn.c:407: error: too many arguments to function 'posixspawn_set_pgroup'
posix-spawn.c:409: warning: implicit declaration of function 'posix_spawnattr_setflags'
posix-spawn.c:418: warning: implicit declaration of function 'posix_spawnp'
posix-spawn.c:427: warning: implicit declaration of function 'posix_spawn_file_actions_destroy'
posix-spawn.c:428: warning: implicit declaration of function 'posix_spawnattr_destroy'
posix-spawn.c:320: warning: unused parameter 'self'
*** Error code 1

Stop in /home/will/.rvm/gems/ruby-1.9.3-preview1/gems/posix-spawn-0.3.6/ext (line 92 of /usr/share/mk/sys.mk).


Gem files will remain installed in /home/will/.rvm/gems/ruby-1.9.3-preview1/gems/posix-spawn-0.3.6 for inspection.
Results logged to /home/will/.rvm/gems/ruby-1.9.3-preview1/gems/posix-spawn-0.3.6/ext/gem_make.out

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.