Skip to content

Commit

Permalink
When running lc inside a PWD which has been deleted used to raise into
Browse files Browse the repository at this point in the history
a quit.  Instead, more like GNU `ls` just swallow that error.  Include a
comment for why (can usefully run `lc` /absolute/path from deleted dir),
& make `x` loadSym template less crazy dense while we're at it.
  • Loading branch information
c-blake committed Aug 18, 2023
1 parent ac0c3a1 commit 09776ee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,10 @@ proc fin*(cf: var LsCf, cl0: seq[string] = @[], cl1: seq[string] = @[],
cf.wrote = false
cf.cl0 = cl0
cf.cl1 = cl1
cf.cwd = getCurrentDir()
template x(e,d):untyped=cast[ExtFmt](if e.len>0:e.loadSym else:cast[pointer](d))
try : cf.cwd = getCurrentDir()
except Ce: discard # quit "PWD deleted" # quit nicer, but not what GNU ls does
template x(e, d): untyped =
cast[ExtFmt](if e.len > 0: e.loadSym else: cast[pointer](d))
cf.ext1c = x(cf.ext1, efRef)
cf.ext2c = x(cf.ext2, efRef)
cg = cf.addr #Init global ptr
Expand Down

0 comments on commit 09776ee

Please sign in to comment.