diff --git a/default.nix b/default.nix index 7529cf51d43..7c9501a8000 100644 --- a/default.nix +++ b/default.nix @@ -52,7 +52,7 @@ let weeder.components.exes.weeder hlint.components.exes.hlint ]) - ++ [ pkgs.haskell-nix.snapshots."lts-13.26".stylish-haskell.components.exes.stylish-haskell ] + ++ [(pkgs.callPackage ./nix/stylish-haskell.nix {})] ++ (with iohkLib; [ openapi-spec-validator ]) ++ [ jormungandr jormungandr-cli pkgs.pkgconfig pkgs.sqlite-interactive ]; diff --git a/lib/core/src/Cardano/Wallet/Api/Server.hs b/lib/core/src/Cardano/Wallet/Api/Server.hs index ab3a7c4d5d9..8f9e6418904 100644 --- a/lib/core/src/Cardano/Wallet/Api/Server.hs +++ b/lib/core/src/Cardano/Wallet/Api/Server.hs @@ -380,7 +380,7 @@ ioToListenError hostPreference portOpt e | isDoesNotExistError e = Just (ListenErrorHostDoesNotExist hostPreference) -- Bad hostname (bind: WSAEOPNOTSUPP) -- Windows - | isUserError e && hasDescription "10045" = + | isUserError e && (hasDescription "11001" || hasDescription "10045") = Just (ListenErrorHostDoesNotExist hostPreference) -- Address is valid, but can't be used for listening -- Linux | show (ioeGetErrorType e) == "invalid argument" = @@ -389,7 +389,8 @@ ioToListenError hostPreference portOpt e | show (ioeGetErrorType e) == "unsupported operation" = Just (ListenErrorInvalidAddress hostPreference) -- Address is valid, but can't be used for listening -- Windows - | isOtherError e && hasDescription "WSAEINVAL" = + | isOtherError e && + (hasDescription "WSAEINVAL" || hasDescription "WSAEADDRNOTAVAIL") = Just (ListenErrorInvalidAddress hostPreference) -- Listening on an unavailable or privileged port -- Windows | isOtherError e && hasDescription "WSAEACCESS" = diff --git a/lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs b/lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs index 2d7679747f7..4220d1b2ebc 100644 --- a/lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs +++ b/lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs @@ -47,6 +47,7 @@ spec = describe "API Server" $ do res `shouldBe` Left ListenErrorOperationNotPermitted it "handles port in use" $ do + skipOnWindows "Windows permits listening on same port multiple times" withListeningSocket "127.0.0.1" ListenOnRandomPort $ \case Right (port, _) -> withListeningSocket "127.0.0.1" (ListenOnPort port) $ \res -> diff --git a/lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs b/lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs index 01fe819065b..f294c4a251c 100644 --- a/lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs +++ b/lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs @@ -183,6 +183,7 @@ spec = describe "Logging Middleware" void $ mapConcurrently (const (get ctx "/get")) (replicate n ()) entries <- readTVarIO (logs ctx) let index = Map.fromList [ (loName l, l) | l <- entries ] + pendingOnWindows "Disabled on windows due to race with log flushing" Map.size index `shouldBe` n it "correct time measures" $ \ctx -> property $ \(nReq, ix) -> diff --git a/nix/stylish-haskell.nix b/nix/stylish-haskell.nix new file mode 100644 index 00000000000..51576dce2d8 --- /dev/null +++ b/nix/stylish-haskell.nix @@ -0,0 +1,21 @@ +{ lib, runCommand, fetchFromGitHub, haskell-nix }: + +let + src = fetchFromGitHub { + owner = "jaspervdj"; + repo = "stylish-haskell"; + rev = "9958a5253a9498c29508895450c4ac47542d5f2a"; + sha256 = "1lc2q15qdhv7xnawdqbrxcdhmy4m7h9v6z1sg4qpyvhf93b43bix"; + }; + + pkgSet = haskell-nix.mkStackPkgSet { + stack-pkgs = (haskell-nix.importAndFilterProject (haskell-nix.callStackToNix { + inherit src; + })).pkgs; + pkg-def-extras = []; + modules = []; + }; + + packages = pkgSet.config.hsPkgs; +in + packages.stylish-haskell.components.exes.stylish-haskell