Project

General

Profile

This project is closed and read-only.

Actions

Bug #3321

closed

Kernel#system do not execute command in subshell even if it contains variable assignments

Bug #3321: Kernel#system do not execute command in subshell even if it contains variable assignments

Added by dram (Xin Wang) over 16 years ago. Updated over 15 years ago.

Status:
Rejected
Assignee:
-
[ruby-core:30320]

Description

=begin
When there are variable assignments in command, Kernel#system in Ruby v1.9 execute it using bare fork&exec instead subshell. It cause command execution failed silently.

So '=' must also be a special character to be recognized as a sign to execute command in subshell.

For example:

$ cat ./script.sh
#!/bin/sh

echo $TEST

$ irb
irb(main):001:0> system('TEST=test ./script.sh')
=> nil
irb(main):002:0> system('TEST=test ./script.sh 2>/dev/null')
test
=> true
irb(main):003:0> ~
=end


Related issues 1 (0 open1 closed)

Has duplicate Ruby - Feature #3426: exec doesn't allow command lines which begin with an env variable assignmentRejectedmame (Yusuke Endoh)Actions
Actions

Also available in: PDF Atom