Run executable node does not get the result sometimes

Hi there
Hope you are well.

So, I am using several run executable nodes in my edge workflow, I call the shell commands(for example, “uptime”, “hostname -I”, etc) using these nodes (I don’t run the scripts on the device, only the shell commands for now).

Most of the time, they get the result properly, but sometimes they don’t get the command result properly. That is, I can not find the result in the stdout field, it is “” in these cases.

So, what is wrong? is there any environment variable I have to modify to fix this issue?

Thanks.

Are those the actual, full commands you are running? For example I am running hostname and am getting a result back every time - though it is the hostname of the docker container, not the host machine.

For example, if you were running cat /a/file/that/does/not/exist.txt, an exit code of 0 and an empty string for stdout would be expected.

I cannot think of any reason the agent itself would occasionally fail to return a result, but if you can provide the full commands you are running, an explanation may arise.

Hi @Dylan_Schuster
Thank you for your update.

I know the run executable command gets the result of the docker container, not the host OS.
So, I need to run the host OS command in this node, so I used the following solution, and it works properly.

For example, I call “uptime” command in the executable node, but as I told you earlier, it gets result sometimes and sometimes not.

I don’t know what is wrong with it for now.
Looking forward to your help.

Regards,

I see; sometimes getting the result and sometimes not sounds like a classic race condition. So I’m guessing you are piping the result of your command to a file and then trying to read that file? My guess is by the time you are trying to read, the process of writing to the file (as handled by the pipe) is not complete.

Can you add a small delay to the process to verify that? You could also refactor your solution to mount the file into the Docker container and use the File: Watch Trigger to start a new workflow execution whenever the file you specify is touched.

Hi @Dylan_Schuster
Thank you for your suggestion.

I added the delay node between the command calling node and output reading node, after that it worked properly.
You were correct. So it took some time to write the command result to the pipe, so if I read it immediately after calling the command, it can not get the result properly.
So, delay node solved the problem.

Thanks again.