Skip to content

Commit

Permalink
Merge pull request #357 from avdv/fix-exception-in-unlinked-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
avdv authored May 10, 2020
2 parents f8674d4 + f34453b commit 40079e1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
21 changes: 20 additions & 1 deletion exe/colorls
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# workaround https://github.com/rubygems/rubygems/issues/3087

# rubocop:disable Style/GlobalVars
$loading = true

class Dir
@@old_pwd = singleton_method(:pwd) # rubocop:disable Style/ClassVars

def self.pwd
@@old_pwd.call
rescue Errno::ENOENT => e
return '/' if $loading

raise e
end
end

require 'colorls'

$loading = false
# rubocop:enable Style/GlobalVars

ColorLS::Flags.new(*ARGV).process
true
2 changes: 1 addition & 1 deletion lib/colorls/flags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def initialize(*args)
def process
init_locale

@args = [Dir.pwd] if @args.empty?
@args = ['.'] if @args.empty?
@args.sort!.each_with_index do |path, i|
next STDERR.puts "\n Specified path '#{path}' doesn't exist.".colorize(:red) unless File.exist?(path)

Expand Down
2 changes: 1 addition & 1 deletion man/colorls.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "COLORLS" "1" "April 2020" "colorls 1.3.3" "colorls Manual"
.TH "COLORLS" "1" "April 2020" "colorls 1.4.0" "colorls Manual"
.
.SH "NAME"
\fBcolorls\fR \- list directory contents with colors and icons
Expand Down

0 comments on commit 40079e1

Please sign in to comment.