Skip to content

Commit 40079e1

Browse files
authored
Merge pull request #357 from avdv/fix-exception-in-unlinked-directory
2 parents f8674d4 + f34453b commit 40079e1

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

exe/colorls

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4+
# workaround https://github.com/rubygems/rubygems/issues/3087
5+
6+
# rubocop:disable Style/GlobalVars
7+
$loading = true
8+
9+
class Dir
10+
@@old_pwd = singleton_method(:pwd) # rubocop:disable Style/ClassVars
11+
12+
def self.pwd
13+
@@old_pwd.call
14+
rescue Errno::ENOENT => e
15+
return '/' if $loading
16+
17+
raise e
18+
end
19+
end
20+
421
require 'colorls'
522

23+
$loading = false
24+
# rubocop:enable Style/GlobalVars
25+
626
ColorLS::Flags.new(*ARGV).process
7-
true

lib/colorls/flags.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def initialize(*args)
3939
def process
4040
init_locale
4141

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

man/colorls.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "COLORLS" "1" "April 2020" "colorls 1.3.3" "colorls Manual"
4+
.TH "COLORLS" "1" "April 2020" "colorls 1.4.0" "colorls Manual"
55
.
66
.SH "NAME"
77
\fBcolorls\fR \- list directory contents with colors and icons

0 commit comments

Comments
 (0)