question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Restarting packaged app not working

See original GitHub issue
  • Version: 21.1.5
  • Target: Windows 10

My application restarts using

    app.relaunch();
    app.quit();

This works fine if run from source or packaged using electron-packager. If the app runs from a single .exe file build by electron-builder, it just exits the application without restarting. Any hints on how to fix this? Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

4reactions
hwoodiwisscommented, Oct 8, 2019

The packaged app is stored as an NSIS archive, so the demo app is running from temp.

If you replace your code with the below, it should resolve your issue:

var opt: Electron.RelaunchOptions = {};
opt.args = process.argv.slice(1).concat(['--relaunch']);
opt.execPath = process.execPath;
if(app.isPackaged && process.env.PORTABLE_EXECUTABLE_FILE != undefined)
{
    opt.execPath = process.env.PORTABLE_EXECUTABLE_FILE;
}
app.relaunch(opt);
app.quit();
1reaction
Araxeuscommented, Feb 24, 2022

for anyone that still encounter this problem like me:

function restart() {
    app.relaunch({ execPath: process.env.PORTABLE_EXECUTABLE_FILE });
    app.quit();
}

execPath will be undefined if not in portable app resulting in the default behavior

Read more comments on GitHub >

github_iconTop Results From Across the Web

App Won't Open on Android? 10 Ways To Fix - Online Tech Tips
You can perform a soft reboot by long-pressing the power button and selecting Restart or swiping the app-shade down, selecting the power icon, ......
Read more >
Troubleshooting packaging, deployment, and query of ...
Error code Value Description and possible causes E_INVALIDARG 0x80070057 ERROR_INSTALL_INVALID_ PACKAGE 0x80073CF2 The package data isn't valid. ERROR_INSTALL_NETWORK_ FAILURE 0x80073CF5 The package can't be downloaded.
Read more >
How to restart self package after update - android
I had the same issue, i needed to update my app and restart it afterwards. I solved it like this: String command =...
Read more >
RStudio Connect, app restart after package updates
Hiya, we're using RStudio Connect in our company (migrated from Shiny Server Pro) and we're running into some issues with package management (e.g....
Read more >
Android Package Installer Not Working - YouTube
Let's fix your Android package installer if it's not working properly in this quick and easy guide.If you find that Android's package ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found