From: naruse Date: 2012-03-18T18:36:51+09:00 Subject: [ruby-core:43427] [ruby-trunk - Feature #4046][Feedback] Saving C's **argv and cwd allows Ruby programs to reliably restart themselves Issue #4046 has been updated by naruse. Description updated Status changed from Open to Feedback argv[0] is not reliable on some environment. see "#! - the Unix truth as far as I know it." http://homepages.cwi.nl/~aeb/std/hashexclam.html I tried to implement with vendor specific functions. https://gist.github.com/1129437 I gave up it because I can't find the way on AIX. Therefore I concluded people should use RbConfig. ---------------------------------------- Feature #4046: Saving C's **argv and cwd allows Ruby programs to reliably restart themselves https://bugs.ruby-lang.org/issues/4046#change-24746 Author: rocky Status: Feedback Priority: Normal Assignee: Category: Target version: 2.0.0 =begin In a debugger often one gets to a state where one just wants to restart everything exactly the way the program was previously invoked. It would helpful if Ruby saved **argv and cwd. The attached patch saves these in RubyVM::OS_ARGV and RubyVM::OS_STARTUP_DIR. With this, if a Ruby program wants to restart itself, it can run: chdir RubyVM::OS_STARTUP_DIR exec(*RubyVM::OS_ARGV) =end -- http://bugs.ruby-lang.org/