Skip to content

Fix Shell#unlink for regular files - #21

Open
wtn wants to merge 1 commit into
ruby:masterfrom
wtn:unlink
Open

wtn wants to merge 1 commit into
ruby:masterfrom
wtn:unlink

Conversation

@wtn

@wtn wtn commented Nov 16, 2026

Copy link
Copy Markdown

Shell::CommandProcessor#unlink calls IO.unlink when the path is not a directory.

But no such method exists, so sh.unlink("some_file") raises:

NoMethodError: undefined method 'unlink' for class IO

Shell#unlink removes directories correctly.

Changes

  • Call File.unlink for non-directory paths.
  • Correct the doc comment, which referred to IO.unlink.
  • Add tests covering unlink on a file and on a directory.

CommandProcessor#unlink called IO.unlink for non-directory paths, but IO
has no unlink method, so removing a file raised NoMethodError. Call
File.unlink instead, and correct the doc comment that pointed to
IO.unlink.

Add tests for unlinking a file and a directory.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ Proxy