You are here

The issue of closing the process before the end of the app

7 posts / 0 new
Last post
paul_guo
Offline
Last seen: 3 years 5 months ago
Joined: 2020-10-24 00:16
The issue of closing the process before the end of the app

I wanted to make a portable app for huya streaming and found that his main process huya.exe still has a huyaservice.exe process running after closing, causing backup of appdata content to fail.I learned that you can use the .nsh file to call killproc to solve the problem, so I put a custom.nsh in the launcher folder of paf.
${SegmentFile}
${SegmentPrePrimary}
KillProcDLL::KillProc “HuyaService.exe”
!macroend
${SegmentPostPrimary}
KillProcDLL::KillProc “HuyaService.exe”
!macroend
But it doesn't seem to be working, so what can I do about it?

John T. Haller
John T. Haller's picture
Online
Last seen: 9 min 19 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Process Bug

KillProc and FindProc from the NSIS folks have a bug that causes them to fail without error when too many processes are running. We use our custom ProcFunc.nsh now which has a TerminateProcess procedure: https://portableapps.com/node/12561

Also, be sure you have the right to kill the process and it's not a user to admin thing.

Sometimes, the impossible can become possible, if you're awesome!

paul_guo
Offline
Last seen: 3 years 5 months ago
Joined: 2020-10-24 00:16
${SegmentFile}

${SegmentFile}

${SegmentPrePrimary}

${TerminateProcess} “HuyaService.exe” $1

!macroend

${SegmentPostPrimary}

${TerminateProcess} “HuyaService.exe” $1

!macroend
I researched and rewrote the code to do this, but it didn't produce what it was supposed to, should I go ahead and edit the .nsi file?

John T. Haller
John T. Haller's picture
Online
Last seen: 9 min 19 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Ending

Is it ending? You don't have it set to wait for it? Can you terminate it from Task Manager?

Sometimes, the impossible can become possible, if you're awesome!

paul_guo
Offline
Last seen: 3 years 5 months ago
Joined: 2020-10-24 00:16
I can terminate it from Task

I can terminate it from Task Manager.But can't using that custon.nsh to end it

John T. Haller
John T. Haller's picture
Online
Last seen: 9 min 19 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Admin?

Have you tried running the app as admin?

Sometimes, the impossible can become possible, if you're awesome!

paul_guo
Offline
Last seen: 3 years 5 months ago
Joined: 2020-10-24 00:16
I used the admin account

I used the admin account directly.
I've now solved the problem by replacing the annoying HuyaService.exe with an empty nop.exe, which solves the problem in another sense

Log in or register to post comments