You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
Packaged exe is not executing in a specific scenario #1241
I have built an executable using pkg command ---> lets call it process B.
Scenario:
We have 2 processes
Process A (in C#)
Process B (Generated using pkg command to run js code)
Runtime:
"Process A" starts "Process B".
Process B stops Process A, executes some business logic, and then restarts Process A.
The above 2 steps are repeated every hour.
Problem:
First time when Process A starts Process B, it works as expected.
But next time when the Process A tries to start Process B, it only open the node console. It does not execute the JS file.
Observation:
When I manually run .load "pathtojs/abc.js" on the opened node console, it works fine.
While starting Process B from Process A, if I pass the path of the js file, it works fine, however
in first iteration, js path is coming as a process argument to my JS process
but in subsequent iteration, js path is not coming as argument, which essentially means, in subsequent iterations the started
process is just node console
Thanks Jesec !! I printed and compared the environment variables in the first cycle and the subsequent cycles. I found one additional environment variable in subsequent cycles, I.e. PKG_EXECPATH.
when I reset it to null in subsequent cycles it works absolutely fine.
Now my doubt is whether any additional environment variable I need to check (although I don’t find any additional variable starting from PKG_ except the one I mention d above).
PS: it’s a windows environment
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label
Activity
jesec commentedon Jul 4, 2021
Sanitize the environment variables before you launch pkg executable from a pkg-launched program.
Specifically
PKG_INVOKE_*.pkg adds it when it launches another program, to allow executing sub programs and avoid infinite loop.
The executed program inherited the variables, will pass it to programs launched by it, and pkg will hit the kill switch.
deepakblr commentedon Jul 5, 2021
Thanks Jesec !! I printed and compared the environment variables in the first cycle and the subsequent cycles. I found one additional environment variable in subsequent cycles, I.e. PKG_EXECPATH.
when I reset it to null in subsequent cycles it works absolutely fine.
Now my doubt is whether any additional environment variable I need to check (although I don’t find any additional variable starting from PKG_ except the one I mention d above).
PS: it’s a windows environment
Hypfer commentedon Jul 6, 2021
@deepakblr It would be nice if you could update the readme with this knowledge if it works now :)
deepakblr commentedon Jul 6, 2021
@Hypfer for sure !!! Will update it and post here
deepakblr commentedon Jul 7, 2021
@Hypfer not able to create Branch, possibly I do not have permission to do so.
github-actions commentedon Oct 6, 2021
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label
github-actions commentedon Oct 11, 2021
This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.