Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
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

Closed

Description

@deepakblr

I have built an executable using pkg command ---> lets call it process B.

Scenario:

We have 2 processes

  1. Process A (in C#)
  2. 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:

  1. When I manually run .load "pathtojs/abc.js" on the opened node console, it works fine.
  2. 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

Activity

  1. jesec commented on Jul 4, 2021

    @jesec
    Contributor

    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.

  2. deepakblr commented on Jul 5, 2021

    @deepakblr
    Author

    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

  3. Hypfer commented on Jul 6, 2021

    @Hypfer
    Contributor

    @deepakblr It would be nice if you could update the readme with this knowledge if it works now :)

  4. deepakblr commented on Jul 6, 2021

    @deepakblr
    Author

    @Hypfer for sure !!! Will update it and post here

  5. deepakblr commented on Jul 7, 2021

    @deepakblr
    Author

    @Hypfer not able to create Branch, possibly I do not have permission to do so.

  6. github-actions commented on Oct 6, 2021

    @github-actions

    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

  7. github-actions commented on Oct 11, 2021

    @github-actions

    This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions