-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
OH3.0.0: ExecUtil.executeCommandLine() is not returning result if command return code !=0 #2033
Comments
Hi, I face the same issue when I run some ping and ssh commands.
As you can see, first result is null:
Stefan |
Still the same in openHAB 3.1.0. Build #2112 |
@kaikreuzer, I also noticed this problem of RC=null when a (DSL) rule ends up with an RC<>0. This makes it extremely hard to find the problem when rules aren't working in OH3. I'm just mentioning you here as I'm not sure if the dev team is aware of this issue. It's still the same in 3.1.0-SNAPSHOT - Build #2127. Thank you! |
This looks like a regression introduced by #1700 to me as this PR explicitly returns null in case of an error RC. @cpmeister Can I assume that this was unintentional? |
I've created #2104 as a fix. |
I am seeing a different but similar error..
See this.. Perhaps related to this.. |
Here is my test case rule, that illustrates it working for
Log outputs:-
|
On the Community Forum Wolfgang_S said the following (I quote)..
Therefore it seems to me that the correct solution is..
|
New PR opened #2114 |
Thanks, I can confirm the bug has been fixed (tested on 3.1.0-SNAPSHOT - Build #2143) |
Just migrate from OH2 to OH3 and I am in general very happy with the new version...
But I am porting my executeCommandLine commands in my rules from OH2 to OH3 and I observerd that some commands are not excecuted because the return value of executeCommandLine is null or "". But it seams they are actually exceuted, only the output is not catched in the result variable.
After playing arround with python2 and python3 scripts I come to the following conclusion:
If the command line returns something !=0 the output is not catched and empty. Also there is no error in the log.
This can be reproduced with the following rule content
var String ScriptPath = "/etc/openhab/scripts/"
var result = executeCommandLine(Duration.ofSeconds(50),"python", ScriptPath+"test.py")
And and the script test.py:
import sys
print("Hallo World")
sys.exit(1)
the result is null or "".
If the script is modified like this:
import sys
print("Hallo World")
sys.exit(0)
result is "Hello World" as expected.
I would say this is a bug or is it a feature? For sure it is not nice that there is not any output in the log if the return value is != 0 and the result variable is empty. Also its diffrent undocumented behaviour to OH2.
See also here: https://community.openhab.org/t/oh3-openhabianpi-executecommandline-returns-always-with-empty-result-for-python2-commands/112056
The text was updated successfully, but these errors were encountered: