MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    child_process won't execute

    Scheduled Pinned Locked Moved Development
    13 Posts 3 Posters 2.8k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      Temisola1
      last edited by

      @sdetweil said in child_process won't execute:

      node testit.js

      Yes, that works in the console.

      1 Reply Last reply Reply Quote 0
      • T Offline
        Temisola1 @sdetweil
        last edited by

        @sdetweil So I tried putting in the full path in my node_helper as opposed to relative path and that seemed to work. is there a way I can log the current directory in nodejs. It seems that’s the issue

        S 1 Reply Last reply Reply Quote 0
        • T Offline
          Temisola1 @sdetweil
          last edited by Temisola1

          @sdetweil after running successfully a few times it now returns Buffer 48 45 5c… or something that looks like hexadecimal code

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @Temisola1
            last edited by

            @Temisola1 the node_helper doesn’t know where it is… but the Modulename does…

            this.path

            so, you can add that to the config info you send down in the typical

            sendSocketNotification(“somevalue”, this.config)

            to pass parameters to the node_helper

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @Temisola1
              last edited by

              @Temisola1 said in child_process won't execute:

              after running successfully a few times it now returns

              u need to cleanup when the invoked process ends

              process.on('exit', function() {
                if (x) {
                  x.kill();
                }
              });
              

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                joshwilsonvu @sdetweil
                last edited by

                @sdetweil I just want to recommend the execa package as it solves some issues with “child_process,” like cleaning up when the process exits.

                1 Reply Last reply Reply Quote 1
                • T Offline
                  Temisola1
                  last edited by

                  Thank you all for all your wonderful suggestions. I’m able to run my python script successfully now. Thanks!

                  1 Reply Last reply Reply Quote 0
                  • 1
                  • 2
                  • 2 / 2
                  • First post
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Sam, technical setup by Karsten.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy