Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Commits
8944c16c
Unverified
Commit
8944c16c
authored
6 years ago
by
gwenn
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #151 from eminence/completions
Ignore all IO errors during completion
parents
851af7ea
852a6f27
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/completion.rs
+23
-13
23 additions, 13 deletions
src/completion.rs
with
23 additions
and
13 deletions
src/completion.rs
+
23
−
13
View file @
8944c16c
...
...
@@ -299,20 +299,30 @@ fn filename_complete(
};
let
mut
entries
:
Vec
<
Pair
>
=
Vec
::
new
();
for
entry
in
try
!
(
dir
.read_dir
())
{
let
entry
=
try
!
(
entry
);
if
let
Some
(
s
)
=
entry
.file_name
()
.to_str
()
{
if
s
.starts_with
(
file_name
)
{
if
let
Ok
(
metadata
)
=
fs
::
metadata
(
entry
.path
())
{
let
mut
path
=
String
::
from
(
dir_name
)
+
s
;
if
metadata
.is_dir
()
{
path
.push
(
sep
);
// if dir doesn't exist, then don't offer any completions
if
!
dir
.exists
()
{
return
Ok
(
entries
);
}
// if any of the below IO operations have errors, just ignore them
if
let
Ok
(
read_dir
)
=
dir
.read_dir
()
{
for
entry
in
read_dir
{
if
let
Ok
(
entry
)
=
entry
{
if
let
Some
(
s
)
=
entry
.file_name
()
.to_str
()
{
if
s
.starts_with
(
file_name
)
{
if
let
Ok
(
metadata
)
=
fs
::
metadata
(
entry
.path
())
{
let
mut
path
=
String
::
from
(
dir_name
)
+
s
;
if
metadata
.is_dir
()
{
path
.push
(
sep
);
}
entries
.push
(
Pair
{
display
:
String
::
from
(
s
),
replacement
:
escape
(
path
,
esc_char
,
break_chars
,
quote
),
});
}
// else ignore PermissionDenied
}
entries
.push
(
Pair
{
display
:
String
::
from
(
s
),
replacement
:
escape
(
path
,
esc_char
,
break_chars
,
quote
),
});
}
// else ignore PermissionDenied
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment