Hook for after electron.exe has completely finished being modified
See original GitHub issue-
Version: 20.22.0
-
Target: Windows
Description: Once Electron builder has finished modifying electron.exe into its final form I would like to apply some changes to the exe manually myself before it is code signed.
Currently I am carrying out these changes in the afterPack
hook, however I think further changes to the exe are taking place by (or a dependency of) electron-builder after this hook has been triggered. I am assuming this because the final .exe file is corrupt and crashes with an Access Violation error.
If I move my .exe modifications a bit later in the build process (e.g. either by dumping them in the custom Windows code signing override/delegate function; or by running them manually after electron builder has completely finished) the .exe works as expected which points to electron-builder doing something to the .exe after the afterPack
hook and before the code signing takes place. I have tried looking through the code but I cannot work out what changes take place in this timeframe.
As I would like to make use of the electron-builder code-signing functionality, I do not want to override the custom sign
function and also cannot make my modifications after electron-builder has finished and the code has been signed. This means I need to try find (or implement) an alternative hook to carry out my tasks after the exe has been completely finished, but before the code signing takes place.
To help me with this, I have a few questions if anyone can give some guidance that would be fantastic:
- Does something happen to the .exe after
afterPack
or am I going down a rabbit hole? I had assumed at this stage the binary was completely finished but it doesn’t seem that way. - Is there any other kind of hook I could hook into that represents “after the .exe is completely finished and won’t be touched again until code-signing”? I have obviously looked at the docs and not found one, but just wanted to ask incase anyone had any ideas or if I have missed something!
- If there isn’t such a hook, would you consider accepting a PR to implement one? E.g. maybe
preCodeSign
orafterPackFinalised
? Obviously once I find out what (if anything) is happening to the exe afterafterPack
it would be easier to come up with aafterX
hook name.
Just for the sake of completeness, I am making similar modifications to the Electron framework binary for OSX, however it doesn’t seem to suffer from this same issue and executing the changes from the afterPack
hook is working.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
afterSign
unfortunately does not meet my needs, I need to carry out a task after the exe is in its final form but before code signing takes place. Effectively my hacked solution to this problem was to override the signing functionality but to then invoke the original signing function, e.g:There is no longer active development on the app I required the functionally for, but I still think a hook for
preSign
to carry out tasks immediately before the signing process makes sense - or at least making it so thatafterPack
is truly after everything is done (e.g. after the.exe
has been modified usingrcedit
). Obviously I am happy to submit a PR for this, I was just originally looking for clarification as to why additional modifications were taking place between theafterPack
and the code signing process.@amfio Please use
afterSign
hook.