Use sponge to avoid need for temp file

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Pedro Pombeiro 2019-09-13 14:50:49 +02:00
parent 061939189b
commit 8ace86f7da
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
{ stdenv, pkgs, callPackage, target-os, { stdenv, pkgs, callPackage, target-os,
cmake, extra-cmake-modules, file, status-go, go, cmake, extra-cmake-modules, file, moreutils, status-go, go,
darwin, nodejs }: darwin, nodejs }:
let let
@ -21,6 +21,7 @@ in {
cmake cmake
extra-cmake-modules extra-cmake-modules
file file
moreutils
snoreNotifySources snoreNotifySources
qtkeychainSources qtkeychainSources
] ++ catAttrs "buildInputs" selectedSources); ] ++ catAttrs "buildInputs" selectedSources);

View File

@ -115,8 +115,8 @@ function compile() {
# Temporarily add path to javascript bundle to package.json # Temporarily add path to javascript bundle to package.json
local jsBundleLine="\"desktopJSBundlePath\": \"$JS_BUNDLE_PATH\"" local jsBundleLine="\"desktopJSBundlePath\": \"$JS_BUNDLE_PATH\""
local jsPackagePath=$(joinExistingPath "$STATUS_REACT_HOME" 'desktop/js_files/package.json') local jsPackagePath=$(joinExistingPath "$STATUS_REACT_HOME" 'desktop/js_files/package.json')
local tmp=$(mktemp)
jq ".=(. + {$jsBundleLine})" "$jsPackagePath" > "$tmp" && mv "$tmp" "$jsPackagePath" jq ".=(. + {$jsBundleLine})" "$jsPackagePath" | sponge "$jsPackagePath"
echo -e "${YELLOW}Added 'desktopJSBundlePath' line to $jsPackagePath:${NC}" echo -e "${YELLOW}Added 'desktopJSBundlePath' line to $jsPackagePath:${NC}"
echo "" echo ""