-
-
Notifications
You must be signed in to change notification settings - Fork 2k
fix standalone executable when dest of symlink #4782
fix standalone executable when dest of symlink #4782
Conversation
Can you add a spec covering the bug this fixes? Thanks! |
@segiddins Absolutely! Are there already specs for this part of the code? I looked for them, but I didn't find them, and I feel like I missed it. |
I'll have a look next time I'm at my computer, but I feel we might have a standalone_specs.rb? |
@segiddins I've dded a spec to confirm that running a symlink works. |
require "tmpdir" | ||
symlink = File.expand_path("rails", Dir.mktmpdir) | ||
File.symlink(bundled_app("bin/rails"), symlink) | ||
expect(`#{symlink} -v`.chomp).to eql "2.3.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sys_exec!("#{symlink} -v")
expect(out).to eq("2.3.2")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm paralleling the nearby test. Should I change it as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure!
👍 from me other than the test comments |
@segiddins sorry I was away. I'm currently addressing the issues you brought up. |
When an executable is the destination of a symlink `__FILE__` contains the path to the symlink, rather than the actual path of the current file. Pathname#realpath resolves symlinks to get the actual location on disk.
Thanks! @homu r+ |
📌 Commit a14c2fb has been approved by |
…indirect fix standalone executable when dest of symlink When an executable is the destination of a symlink `__FILE__` contains the path to the symlink, rather than the actual path of the current file. `Pathname#realpath` resolves symlinks to get the actual location on disk.
💔 Test failed - status |
@homu retry |
…indirect fix standalone executable when dest of symlink When an executable is the destination of a symlink `__FILE__` contains the path to the symlink, rather than the actual path of the current file. `Pathname#realpath` resolves symlinks to get the actual location on disk.
☀️ Test successful - status |
When an executable is the destination of a symlink
__FILE__
containsthe path to the symlink, rather than the actual path of the current
file.
Pathname#realpath
resolves symlinks to get the actual location on disk.