diff options
| author | Simen Heggestøyl | 2017-08-09 15:34:34 +0200 |
|---|---|---|
| committer | Simen Heggestøyl | 2017-09-05 20:31:21 +0200 |
| commit | fca62384537e1a32e867f4d3181e0b2b79396383 (patch) | |
| tree | c6586fb7df23770b3f2f7763a9d3337c05653285 /lisp | |
| parent | 25a49f64963d1c2a392ebaa66676042b55e0e3c1 (diff) | |
| download | emacs-fca62384537e1a32e867f4d3181e0b2b79396383.tar.gz emacs-fca62384537e1a32e867f4d3181e0b2b79396383.zip | |
Handle non-zero exit status from psql more gracefully
* lisp/progmodes/sql.el (sql-postgres-list-databases): Handle non-zero
exit statuses from `psql -ltX' more gracefully by returning nil.
* test/lisp/progmodes/sql-tests.el
(sql-tests-postgres-list-databases-error): New test.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/sql.el | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index b176e52950c..48e21605a33 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el | |||
| @@ -1095,9 +1095,10 @@ add your name with a \"-U\" prefix (such as \"-Umark\") to the list." | |||
| 1095 | "Return a list of available PostgreSQL databases." | 1095 | "Return a list of available PostgreSQL databases." |
| 1096 | (when (executable-find sql-postgres-program) | 1096 | (when (executable-find sql-postgres-program) |
| 1097 | (let ((res '())) | 1097 | (let ((res '())) |
| 1098 | (dolist (row (process-lines sql-postgres-program "-ltX")) | 1098 | (ignore-errors |
| 1099 | (when (string-match "^ \\([[:alnum:]-_]+\\) +|.*" row) | 1099 | (dolist (row (process-lines sql-postgres-program "-ltX")) |
| 1100 | (push (match-string 1 row) res))) | 1100 | (when (string-match "^ \\([[:alnum:]-_]+\\) +|.*" row) |
| 1101 | (push (match-string 1 row) res)))) | ||
| 1101 | (nreverse res)))) | 1102 | (nreverse res)))) |
| 1102 | 1103 | ||
| 1103 | ;; Customization for Interbase | 1104 | ;; Customization for Interbase |