From 2d35cce6ead00a10522fa3046069816c330b5f3a Mon Sep 17 00:00:00 2001 From: "Andre A. Gomes" Date: Mon, 23 Sep 2024 12:26:12 +0300 Subject: Delete socket-p logic. --- source/start.lisp | 17 +++-------------- source/utilities.lisp | 18 ------------------ 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/source/start.lisp b/source/start.lisp index 75c790cf0..269e505b5 100644 --- a/source/start.lisp +++ b/source/start.lisp @@ -308,11 +308,6 @@ It takes URL-STRINGS so that the URL argument can be `cl-read' in case (files:expand *socket-file*))) (iolib:socket-connected-p s)))) -(defun existing-non-socket-p (path) - (and (or (uiop:file-exists-p path) - (uiop:directory-exists-p path)) - (not (socket-p path)))) - (-> listen-or-query-socket ((or null (cons quri:uri *))) *) (defun listen-or-query-socket (urls) "If another Nyxt is listening on the socket, tell it to open URLS. @@ -329,9 +324,6 @@ Otherwise bind socket and return the listening thread." (format s "~s" `(open-external-urls ,@(mapcar #'quri:render-uri urls))))) (log:info "Nyxt already started.")) nil) - ((existing-non-socket-p socket-path) - (log:error "Could not bind socket ~a, non-socket file exists." socket-path) - nil) (t (uiop:delete-file-if-exists socket-path) ; Safe since socket-path is a :socket at this point. (run-thread "socket listener" @@ -496,13 +488,10 @@ Finally, run the browser, load URL-STRINGS if any, then run (let* ((urls (remove-if #'url-empty-p (mapcar #'url url-strings))) (startup-timestamp (time:now)) - (startup-error-reporter nil) - (socket-path (files:expand *socket-file*))) + (startup-error-reporter nil)) (if (or (getf *options* :no-socket) - (null socket-path) - (and ; See `listen-or-query-socket'. - (not (listening-socket-p)) - (not (existing-non-socket-p socket-path)))) + (null (files:expand *socket-file*)) + (not (listening-socket-p))) (progn (load-lisp (files:expand *auto-config-file*) :package (find-package :nyxt-user)) (multiple-value-bind (condition backtrace) diff --git a/source/utilities.lisp b/source/utilities.lisp index de798659e..d08485653 100644 --- a/source/utilities.lisp +++ b/source/utilities.lisp @@ -221,24 +221,6 @@ package set to current package." (uiop:with-safe-io-syntax (:package package) (uiop:slurp-stream-forms stream)))) -(export-always 'socket-p) -(defun socket-p (path) - "Return non-nil if a PATH is a socket." - (and (uiop:file-exists-p path) - #+darwin - (equal "=" (uiop:run-program (list "stat" "-f" "%T" path) - :output '(:string :stripped t))) - #+(and (not darwin) (not sbcl)) - (eq :socket (osicat:file-kind path)) - #+(and (not darwin) sbcl) - (flet ((socket-p (path) - (let ((socket-mask 49152) - (mode-mask 61440)) - (= socket-mask - (logand mode-mask - (sb-posix:stat-mode (sb-posix:stat path))))))) - (socket-p path)))) - (export-always 'has-method-p) (defun has-method-p (object generic-function) "Return non-nil if OBJECT has GENERIC-FUNCTION specialization." -- cgit v1.2.3-70-g09d2