# Questions about the EXEC node

**URL:** https://discourse.nodered.org/t/questions-about-the-exec-node/90558
**Category:** General
**Created:** [30 August 2024 14:24 UTC](https://discourse.nodered.org/t/questions-about-the-exec-node/90558 "2024-08-30T14:24:05Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![nearbyatom](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@nearbyatom](https://discourse.nodered.org/u/nearbyatom)
#### Post date: [30 August 2024 14:24 UTC](https://discourse.nodered.org/t/questions-about-the-exec-node/90558/1 "2024-08-30T14:24:05Z")

</div>

I have this exec block that executes when I press the inject button

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/e/7eed7457965bc216d70325f40e6af68214072b35.png)

There this process ID that pops up. Is there a way to pull that off and put it onto a payload so I can do stuff with it?

Another question:  
Same exec block, how do I know it's done executing?

I have 3 debugger blocks at the end of the exec.

They give me messages that look like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/6/06f98a42df4ca03af0018689e4b035e95153a051.png)  
Is there a way to get a pass/fail to execute from the exec block?

Any help would be appreciated.

```auto
[
    {
        "id": "1017b92c740fd65f",
        "type": "tab",
        "label": "Flow 4",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "fa121ac2571e947c",
        "type": "exec",
        "z": "1017b92c740fd65f",
        "command": "C:\\ti\\ccs1220\\ccs\\ccs_base\\scripting\\bin\\dss -f c:\\ztemp\\loadgreen.js",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "10",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 480,
        "y": 180,
        "wires": [
            [
                "65ee604f18e7a518"
            ],
            [
                "5a548955f5dccb7f"
            ],
            [
                "aca287bf06caf545"
            ]
        ]
    },
    {
        "id": "65ee604f18e7a518",
        "type": "debug",
        "z": "1017b92c740fd65f",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 810,
        "y": 120,
        "wires": []
    },
    {
        "id": "5a548955f5dccb7f",
        "type": "debug",
        "z": "1017b92c740fd65f",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 810,
        "y": 180,
        "wires": []
    },
    {
        "id": "aca287bf06caf545",
        "type": "debug",
        "z": "1017b92c740fd65f",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 810,
        "y": 240,
        "wires": []
    },
    {
        "id": "fb918985f29ac37d",
        "type": "inject",
        "z": "1017b92c740fd65f",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 220,
        "wires": [
            [
                "fa121ac2571e947c"
            ]
        ]
    },
    {
        "id": "908f075511940f3e",
        "type": "exec",
        "z": "1017b92c740fd65f",
        "command": "C:\\ti\\ccs1220\\ccs\\ccs_base\\scripting\\bin\\dss -f c:\\ztemp\\loadred.js",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "10",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 480,
        "y": 360,
        "wires": [
            [
                "8285f3bc0e0ba7a1"
            ],
            [
                "28e237ff7f069e6b"
            ],
            [
                "60cd2dd0685708c4"
            ]
        ]
    },
    {
        "id": "8285f3bc0e0ba7a1",
        "type": "debug",
        "z": "1017b92c740fd65f",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 810,
        "y": 300,
        "wires": []
    },
    {
        "id": "28e237ff7f069e6b",
        "type": "debug",
        "z": "1017b92c740fd65f",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 810,
        "y": 360,
        "wires": []
    },
    {
        "id": "60cd2dd0685708c4",
        "type": "debug",
        "z": "1017b92c740fd65f",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 810,
        "y": 420,
        "wires": []
    },
    {
        "id": "ddf76a28ac7af090",
        "type": "inject",
        "z": "1017b92c740fd65f",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 120,
        "y": 420,
        "wires": [
            [
                "908f075511940f3e"
            ]
        ]
    },
    {
        "id": "ddcaab3fd066fd0c",
        "type": "ui_button",
        "z": "1017b92c740fd65f",
        "name": "",
        "group": "88145eb0.23895",
        "order": 7,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "GREEN",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "",
        "payloadType": "date",
        "topic": "topic",
        "topicType": "msg",
        "x": 140,
        "y": 160,
        "wires": [
            [
                "fa121ac2571e947c"
            ]
        ]
    },
    {
        "id": "8888de70d06a91cf",
        "type": "ui_button",
        "z": "1017b92c740fd65f",
        "name": "",
        "group": "88145eb0.23895",
        "order": 7,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "RED",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "",
        "payloadType": "date",
        "topic": "topic",
        "topicType": "msg",
        "x": 130,
        "y": 360,
        "wires": [
            [
                "908f075511940f3e"
            ]
        ]
    },
    {
        "id": "88145eb0.23895",
        "type": "ui_group",
        "name": "PLC_Read",
        "tab": "a9e24f558660ab0d",
        "order": 1,
        "disp": true,
        "width": "8",
        "collapse": false,
        "className": ""
    },
    {
        "id": "a9e24f558660ab0d",
        "type": "ui_tab",
        "name": "MAIN",
        "icon": "dashboard",
        "order": 2,
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [30 August 2024 14:28 UTC](https://discourse.nodered.org/t/questions-about-the-exec-node/90558/2 "2024-08-30T14:28:25Z")

</div>

> [@nearbyatom](#):
>
> There this process ID that pops up. Is there a way to pull that off and put it onto a payload so I can do stuff with it?

use a `status` node pointed at the `exec` node. Use a debug set to show full message to see everything the status message contains.

> [@nearbyatom](#):
>
> Same exec block, how do I know it's done executing?

Read the built in help. Return code is the result of completed execution.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/9/997de72b5c66ec805d00c1636c891444dc648a3c.png)

---

<div class="post-metadata">

### Author: ![nearbyatom](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@nearbyatom](https://discourse.nodered.org/u/nearbyatom)
#### Post date: [30 August 2024 14:46 UTC](https://discourse.nodered.org/t/questions-about-the-exec-node/90558/3 "2024-08-30T14:46:48Z")

</div>

you mean like this?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/c/cc058a5bf57ff50f5d10d66492df821169f743f8.png)

I configured the status nodes to look at the exec blocks. It tells me my payload is undefined.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/b/ab2112b62f010332aea3a353415d51ba6a81cb31.png)

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [30 August 2024 15:04 UTC](https://discourse.nodered.org/t/questions-about-the-exec-node/90558/4 "2024-08-30T15:04:24Z")

</div>

Set the debug to `show the complete message object`, there you will find msg.status.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [30 August 2024 15:05 UTC](https://discourse.nodered.org/t/questions-about-the-exec-node/90558/5 "2024-08-30T15:05:46Z")

</div>

> [@nearbyatom](#):
>
> you mean like this?  
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/c/cc058a5bf57ff50f5d10d66492df821169f743f8.png)

full message

> [@Steve-Mcl](#):
>
> use a `status` node pointed at the `exec` node. Use a debug set to show full message to see everything the status message contains.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [30 August 2024 15:14 UTC](https://discourse.nodered.org/t/questions-about-the-exec-node/90558/6 "2024-08-30T15:14:58Z")

</div>

> [@Steve-Mcl](#):
>
> Use a debug set to show full message

I don't think you did the full message bit, or if you did you did not look at the output carefully enough. In addition perhaps you have not looked at the help text for the status node.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [28 November 2024 15:15 UTC](https://discourse.nodered.org/t/questions-about-the-exec-node/90558/7 "2024-11-28T15:15:23Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
