Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 37f99be

Browse files
committed
Allow isSecondInstanceWithURL on Darwin
1 parent c09d24d commit 37f99be

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

cardano-launcher/app/Main.hs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,20 @@ main = silence $ do
144144
-- XXX: In a special case, when `cardano-launcher` is given a
145145
-- `mURL` (web+cardano://…) on the command line, we want to
146146
-- allow the second instance. Then, Daedalus will notify its
147-
-- first instance to handle this particular URL. This needs to
148-
-- happen only on Linux and Windows, since macOS has its own
149-
-- mechanism to notify already running applications to open
150-
-- URLs, which Electron implements. In such a case, we also
151-
-- skip TLS setup.
147+
-- first instance to handle this particular URL using internal
148+
-- Electron mechanism. This must happen on Linux and Windows,
149+
-- since macOS has its own mechanism to notify already running
150+
-- applications to open URLs, which Electron implements. But
151+
-- it’s nice to have on macOS as well, since the user can
152+
-- still run Daedalus from a terminal. In second instance, we
153+
-- also skip the TLS setup (Daedalus won’t start 2nd cardano).
152154
--
153155
-- Otherwise, will throw an exception if the application is
154156
-- already running.
155-
(isSecondWindowsInstanceWithURL, lockHandle) <- E.try (checkIfApplicationIsRunning lockFile) >>= \case
157+
(isSecondInstanceWithURL, lockHandle) <- E.try (checkIfApplicationIsRunning lockFile) >>= \case
156158
Right hndl -> pure (False, Just hndl)
157159
Left exception@ApplicationAlreadyRunningException ->
158-
if isJust mURL && (OS.buildOS == OS.Windows || OS.buildOS == OS.Linux) then
160+
if isJust mURL then
159161
pure (True, Nothing)
160162
else
161163
throwM exception
@@ -171,7 +173,7 @@ main = silence $ do
171173

172174
-- Configuration from the launcher options.
173175
let mTlsConfig :: Maybe TLSConfiguration
174-
mTlsConfig = if isSecondWindowsInstanceWithURL then Nothing else loTlsConfig launcherOptions
176+
mTlsConfig = if isSecondInstanceWithURL then Nothing else loTlsConfig launcherOptions
175177

176178
let daedalusBin :: DaedalusBin
177179
daedalusBin = getDPath launcherOptions

0 commit comments

Comments
 (0)