You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Variable assignment fails due to piping no values in an empty directory #8393
A:error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)deprecated:questionQuestions should be redirected to GitHub discussions
You can ignore errors with the do command. You can read help do let x = do -i {ls | where size >= 2kB }
You can use the newer try catch construct. help try let x = try { ls | where size >= 2kB } catch { [] }
A:error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)deprecated:questionQuestions should be redirected to GitHub discussions
Activity
ahkrr commentedon Mar 10, 2023
You can ignore errors with the
docommand. You can readhelp dolet x = do -i {ls | where size >= 2kB }You can use the newer
try catchconstruct.help trylet x = try { ls | where size >= 2kB } catch { [] }amtoine commentedon Jun 18, 2023
i cannot reproduce this with the latest revision of Nushell 🤔
EDIT: looks to me it's because now
lsreturns an empty list when the directory is empty 👌doing a
git bisectand running the following commandcargo run -- -c "print $'(ls /tmp/empty | describe) (char lparen)(ls /tmp/empty | length)(char rparen)'"to see the type returned by
lsand the length of the table (/tmp/emptyis an empty directory)the output was
nothing (0)on ccd72fa, i.e. just before this issue and is now, i.e. on 6c730de,list<any> (0), explaining why this works now 😌git bisect: Fix ls behaviour when directory is empty #8439ehe this makes sense now, just after this issue 😮 😏
Treat empty pipelines as pass-through (#8395)
Revert #8395 "Treat empty pipelines as pass-through" (#9472)