0

I am trying to execute a command line instruction using node, I want to achieve two things: One which is wait for the process to actually finish before it diverts the user to another page. And the other is to run it successfully (unsurprisingly!).

The alteryx workflow I am running is confirming it is being triggered, but node is telling me I have an error.

Error Message

  if (report=="analyse"){
                const { exec } = require("child_process");
                var command = '"C:\\Program Files\\Alteryx\\bin\\AlteryxEngineCmd.exe" "C:\\Users\\katherine\\Billing System\\alteryx\\3. analyseV2.yxwz"';

                exec(command,  (error, stdout, stderr) => {
                    if (error) {
                        console.log(`error: ${error.message}`);
                        return;
                    };
                    if (stderr) {
                        console.log(`stderr: ${stderr}`);
                        return;
                    };

                    callback(stdout);
                    
            });
  • Does this answer your question? [How to wait for a child process to finish in Node.js?](https://stackoverflow.com/questions/22337446/how-to-wait-for-a-child-process-to-finish-in-node-js) – Liam May 07 '21 at 12:20
  • 1
    Are you using an IDE? The condition block is not closed which correctly causes a syntax error. –  May 07 '21 at 12:23
  • `AlteryxEngineCmd.exe` will also return an exit code as 1 for warnings (maybe there is a warning). If so you will want to check the exitCode manually. I would personally console log the stdout, stderr before the error check to see what it's returning.. – Keith May 07 '21 at 12:27

0 Answers0