Project

General

Profile

Actions

Bug #6249

closed

Process.exec doesn't restore the environment if it fails

Added by john_firebaugh (John Firebaugh) about 12 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
Backport:
[ruby-core:44093]

Description

ENV["foo"]
=> nil
Process.exec({"foo" => "bar"}, "nonexistent")
Errno::ENOENT: No such file or directory - nonexistent
from (irb):2:in exec' from (irb):2 from /Users/john/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in '
ENV["foo"]
=> "bar"

I expected that Process.exec would either use execle or execve, or (if it implements environment modification itself), to manually restore the existing environment upon failure.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0