[gnome-shell] runDialog: Ignore expected IO errors while enumerating $PATH
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] runDialog: Ignore expected IO errors while enumerating $PATH
- Date: Mon, 18 Mar 2013 17:00:49 +0000 (UTC)
commit 1cc726593eb3bce60d6ca41488d9a80ce96fc599
Author: Rui Matos <tiagomatos gmail com>
Date: Mon Mar 18 15:53:11 2013 +0100
runDialog: Ignore expected IO errors while enumerating $PATH
$PATH might contain non-existent or non-directory entries. Ignore
those error cases.
https://bugzilla.gnome.org/show_bug.cgi?id=696064
js/ui/runDialog.js | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index bedea40..9d288d9 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -161,16 +161,22 @@ const RunDialog = new Lang.Class({
let paths = GLib.getenv('PATH').split(':');
paths.push(GLib.get_home_dir());
let someResults = paths.map(function(path) {
- let file = Gio.File.new_for_path(path);
- let fileEnum = file.enumerate_children('standard::name', Gio.FileQueryInfoFlags.NONE, null);
- let info;
let results = [];
- while ((info = fileEnum.next_file(null))) {
- let name = info.get_name();
- if (name.slice(0, text.length) == text)
- results.push(name);
+ try {
+ let file = Gio.File.new_for_path(path);
+ let fileEnum = file.enumerate_children('standard::name', Gio.FileQueryInfoFlags.NONE, null);
+ let info;
+ while ((info = fileEnum.next_file(null))) {
+ let name = info.get_name();
+ if (name.slice(0, text.length) == text)
+ results.push(name);
+ }
+ } catch (e if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND) &&
+ !e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_DIRECTORY))) {
+ log(e);
+ } finally {
+ return results;
}
- return results;
});
let results = someResults.reduce(function(a, b) {
return a.concat(b);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]