dsheiko / nw-autoupdater

⛔️ [DEPRECATED] Library provides low-level API to control NW.js app auto-updates
MIT License
75 stars 36 forks source link

App does not restart after exiting post update (LINUX) #22

Open vinaynb opened 7 years ago

vinaynb commented 7 years ago

Hey @dsheiko hope you can help me out here.

Current OS - linux x64 I am currently following basic steps (swapping strategy)

cd example/server
npm i
npm start
cd ../client-strategy-script
npm i
npm package
cd /tmp/Sandbox
unzip ~/Sites/nw-autoupdater/example/server/releases/nw-autoupdater-demo-r1.0.0-osx-x64.zip -d .
cd -
npm version patch
cd -
open -a nw-autoupdater-demo.app

App downloads update successfully, backup folder is created successfully, current app exits but new one does not restart. I tried supplying a log file and checking for logs but there are no errors being reported there. I know that we open a background process via spawn to perform the swapping but i cannot figure out where to look for errors occurring in that spawned process (assuming there's some error in that process which prevents new app to start). Can you guide me as to where should i look for logs that may indicate why the restart fails ?

Also i cannot perform the update unless i start the application using sudo as without it app is unable to unzip the new version in /tmp folder because of insufficient permissions. I temporarily changed /tmp permissions to get around this.

Thanks for this project, appreciate your efforts !

vinaynb commented 7 years ago

This issue is similar to #21 except that i use nw-builder instead of nwjs-builder-phoenix.

vinaynb commented 7 years ago

Update: I observed strange behaviour. When starting app with a certain version (say 1.0, 2.0 is available) there is a certain error window shown by nw.js which contains message "Your preferences could not be saved". If i don't close that window first before going ahead for downloading update, then the app does not restart successfully.

But if i do close that window before starting update progress, the new app with v 2.0 starts successfully and all happens as expected. Attaching the screenshot of window shown by nw.js

screenshot from 2017-09-18 19 59 46

@dsheiko do you have any idea what's going on because of that window and does it really affect the restart process ?

Also i have one more question - i have modified the shell script and put some echo statements just to debug. Below is my swap.sh in my project

#!/bin/bash
for i in "$@"
do
case $i in
  --app-path=*)
    APP_PATH="${i#*=}"
    shift
    ;;
  --bak-path=*)
    BAK_PATH="${i#*=}"
    shift
    ;;
  --update-path=*)
    UPDATE_PATH="${i#*=}"
    shift
    ;;
  --runner=*)
    RUNNER="${i#*=}"
    shift
    ;;
  --verbose=*)
    VERBOSE="${i#*=}"
    shift
    ;;
    *)
            # unknown option
    ;;
esac
done
echo "rsync -al${VERBOSE} --delete ${APP_PATH}/. ${BAK_PATH}/"
rsync -al${VERBOSE} --delete "${APP_PATH}/." "${BAK_PATH}/"
echo " "
echo "123"
echo "rsync -al${VERBOSE} --delete ${UPDATE_PATH}/. ${APP_PATH}/"
rsync -al${VERBOSE} --delete "${UPDATE_PATH}/." "${APP_PATH}/"
echo "456"

echo " "
echo "Hello world"
echo "$APP_PATH/${RUNNER}&"
"$APP_PATH/${RUNNER}"&
echo "Hello world ends"

I have custom logPath and the only log i see in there is echo of first rsync command. Nothing else. Even in cases of successful restart all i see is just one entry of that first rsync command. Is that normal ?

Arti3DPlayer commented 6 years ago

I have custom logPath and the only log i see in there is echo of first rsync command. Nothing else. Even in cases of successful restart all i see is just one entry of that first rsync command. Is that normal ?

the same