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
Get-ChildItem on Linux terminates abruptly when accessing directory fails with access denied or file not found #2856
This repro'd for me on Ubuntu16.04 with alpha.16. It may depend on if you have a .gvfs directory in your home directory. dir -force works, but that's not user friendly particularly when ls works happily without issue.
changed the title [-]Get-ChildItem on Linux terminates abruptly when accessing directory fails with access denied[/-][+]Get-ChildItem on Linux terminates abruptly when accessing directory fails with access denied or file not found[/+]on May 8, 2017
I'm hearing this also repros if the file gets renamed or deleted while get-childitem is running. Generally, get-childitem shouldn't be throwing terminating errors.
Paul Higinbotham (@PaulHigin) The function that walks directories does handle specific exceptions: ArgumentException, IOException and UnauthorizedAccessException. I'm going to be adding additional try/catch handlers for more specific IO exception types a little deeper in scope within the function.
I'm thinking what we would want is if a single file or sub-directory within a directory triggers an error we should not abandon that directory, just write an error and move on to the next entry. If, however, the "current" directory itself goes away mid-process then we abandon that directory and go back up to the parent if present. Does that make sense?
Activity
MaximoTrinidad commentedon Dec 8, 2016
Question: Which version of OS(Ubuntu/RedHat,Fedora...), and version PowerShell?

Ubuntu 16.04.1 on PowerShell v6.0.0.0-Alpha-13 works fine.
SteveL-MSFT commentedon Mar 4, 2017
This repro'd for me on Ubuntu16.04 with alpha.16. It may depend on if you have a .gvfs directory in your home directory.
dir -forceworks, but that's not user friendly particularly whenlsworks happily without issue.PaulHigin commentedon Mar 6, 2017
Agreed. We need to make "cannot access" errors non-terminating.
SteveL-MSFT commentedon Mar 20, 2017
No longer repro'ing for me on Ubuntu16 with alpha.17
[-]Get-ChildItem on Linux terminates abruptly when accessing directory fails with access denied[/-][+]Get-ChildItem on Linux terminates abruptly when accessing directory fails with access denied or file not found[/+]SteveL-MSFT commentedon May 8, 2017
I'm hearing this also repros if the file gets renamed or deleted while get-childitem is running. Generally, get-childitem shouldn't be throwing terminating errors.
2 remaining items
jeffbi commentedon May 9, 2017
Paul Higinbotham (@PaulHigin) The function that walks directories does handle specific exceptions:
ArgumentException,IOExceptionandUnauthorizedAccessException. I'm going to be adding additional try/catch handlers for more specific IO exception types a little deeper in scope within the function.I'm thinking what we would want is if a single file or sub-directory within a directory triggers an error we should not abandon that directory, just write an error and move on to the next entry. If, however, the "current" directory itself goes away mid-process then we abandon that directory and go back up to the parent if present. Does that make sense?
PaulHigin commentedon May 10, 2017
jeffbi Yes, I agree. This sounds like the right behavior.