Skip to content

Kernel#system fails with out: $stdout #5865

@elia

Description

@elia

Environment

  • Darwin Elia.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

Expected Behavior

⤑ ruby -ve 'system("echo hello world", out: $stdout)'
ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin18]
hello world
⤑ 

Actual Behavior

⤑ ruby -ve 'system("echo hello world", out: $stdout)'                          ~
jruby 9.2.6.0 (2.5.3) 2019-02-11 15ba00b Java HotSpot(TM) 64-Bit Server VM 25.25-b02 on 1.8.0_25-b17 +jit [darwin-x86_64]
NotImplementedError: cyclic redirects in child are not supported
  system at org/jruby/RubyKernel.java:1661
  <main> at -e:1

📝 Should be noted that this happens only using $stdout, with other out: destinations works fine:

⤑ ruby -ve 'system("echo hello world", out: $stderr)'                                                                                ~
jruby 9.2.6.0 (2.5.3) 2019-02-11 15ba00b Java HotSpot(TM) 64-Bit Server VM 25.25-b02 on 1.8.0_25-b17 +jit [darwin-x86_64]
hello world
⤑ ruby -ve 'system("echo hello world", out: File.new("/tmp/foo.txt","w"))'                                                           ~
jruby 9.2.6.0 (2.5.3) 2019-02-11 15ba00b Java HotSpot(TM) 64-Bit Server VM 25.25-b02 on 1.8.0_25-b17 +jit [darwin-x86_64]
⤑ cat /tmp/foo.txt                                                                                                                   ~
hello world
⤑                     

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions