on master help sign in
Merge pull request #251 from obsidiansystems/fix-nix-build

Fix trailing newline issue with nix-build

commitce7fbb138523b842d0a4357d611d6e6cd3b54e85 authorLuigy Leon <luichi.19@gmail.com> dateThu 18 Oct 2018, 17:22 (8 years ago) parent35a8c625175b7d
1 file changed+4−1
lib/command/src/Obelisk/Command/Nix.hs+4−1
lib/command/src/Obelisk/Command/Nix.hs+4−1
@@ -87,8 +87,11 @@ instance Default NixBuildConfig where
8787
8888nixBuild :: MonadObelisk m => NixBuildConfig -> m FilePath
8989nixBuild cfg = withSpinner' ("Running nix-build on " <> desc) (Just $ const $ "Built " <> desc) $ do
90− withNixRemoteCheck $ fmap T.unpack $ readProcessAndLogStderr Debug $ proc "nix-build" $ mconcat
90+ output <- withNixRemoteCheck $ readProcessAndLogStderr Debug $ proc "nix-build" $ mconcat
9191 [[path], attrArg, args, outLink, buildersArg]
92+ -- Remove final newline that Nix appends
93+ Just (outPath, '\n') <- pure $ T.unsnoc output
94+ pure $ T.unpack outPath
9295 where
9396 path = _target_path $ _nixBuildConfig_target cfg
9497 attr = _target_attr $ _nixBuildConfig_target cfg