Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

catch ispath errors on discovery #9

Merged
merged 2 commits into from
Nov 14, 2017
Merged

catch ispath errors on discovery #9

merged 2 commits into from
Nov 14, 2017

Conversation

una-dinosauria
Copy link
Contributor

paths might contain system paths where running ls is forbidden. This change simply allows the program to continue even if the exception is raised on some paths.

`paths` might contain system paths where running `ls` is forbidden. This change simply catches the exception.
@maleadt
Copy link
Member

maleadt commented Nov 13, 2017

ispath can throw? What does that have to do with runnin ls; doesn't ispath just check the stat info?
The unique call should probably still be outside the try..catch though, or in the case of an exception multiple identical paths can be considered (triggering warnings later on).

@una-dinosauria
Copy link
Contributor Author

ispath can throw?

It's throwing on my machine.

What does that have to do with runnin ls; doesn't ispath just check the stat info?

Ah correct. ispath calls stat, which is the culprit.

julia> paths[16]
"/var/cfengine/bin/nvidia-smi"

julia> ispath(paths[16])
ERROR: stat: permission denied (EACCES)
Stacktrace:
 [1] stat(::String) at ./stat.jl:69
 [2] ispath(::String) at ./stat.jl:279

The unique call should probably still be outside the try..catch though, or in the case of an exception multiple identical paths can be considered (triggering warnings later on).

I've pushed that change.

@maleadt maleadt merged commit 31063fa into JuliaGPU:master Nov 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants