Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add format options for stdout from Execute Command nodes #58

Closed
0ptimus opened this issue Oct 10, 2019 · 2 comments
Closed

Add format options for stdout from Execute Command nodes #58

0ptimus opened this issue Oct 10, 2019 · 2 comments

Comments

@0ptimus
Copy link

0ptimus commented Oct 10, 2019

Hi,

Let's say I have a home directory with three files named "test1", "test2", and "test3" and I add an Execute Command node with the command as "ls ~". The stdout as of now will be one line as "test1 test2 test3". Not sure if this by design or not. Can an option be added to put the output on separate lines or honor UNIX newlines. So would like output to be like:

test1
test2
test3

Thanks to the developer. Liking this project so far BTW .

@janober
Copy link
Member

janober commented Nov 16, 2019

Very sorry for getting back to this so late!

Please post all further questions to:
https://community.n8n.io/
I will then also respond much faster! And if you do not get an answer within 24h simply ping me.

There are actualy already new line "\n" characters in the response. Only the UI does not display them in the view (as \n does not create a new line in HTML). But as soon as you use them in an expression you will see that it works like in this example:

{
  "nodes": [
    {
      "parameters": {
        "command": "ls "
      },
      "name": "Execute Command",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        430,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "files",
              "value": "={{$node[\"Execute Command\"].data[\"stdout\"]}}"
            }
          ]
        }
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        580,
        300
      ]
    }
  ],
  "connections": {
    "Execute Command": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Really have to find a proper solution that the newline characters get displayed also in the UI!

@janober
Copy link
Member

janober commented Nov 16, 2019

Ok just pushed a "fix":
10881b3

It uses now a different library for the JSON data. That one displays now new-lines correctly. Will be released with the next n8n version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants