openhab / openhab-js

openHAB JavaScript Library for JavaScript Scripting Automation
https://www.openhab.org/addons/automation/jsscripting/
Eclipse Public License 2.0
38 stars 31 forks source link

fix executeCommandLine without a Duration #229

Closed rkoshak closed 1 year ago

rkoshak commented 1 year ago

Without a Duration argument, executeCommandLine always returns null. I removed the example that appears to show calling it without a Duration and getting the result of the echo. That can't happen as it's currently implemented.

Also, we need to use time.Duration right? I'm pretty sure that's the case. If I'm wrong and that's not the case, we should show importing java.time.Duration in the example.

I think I forgot to sign off on this. This is really minor doc update, I hope the exception can apply. If not I'll figure out how to fix it.

florian-h05 commented 1 year ago

I‘ve just checked the core JavaDoc, executeCommandLine without a Duration is only void, no wonder it is always null.

Also, we need to use time.Duration right?

Yes (we don‘t need, Java Duration also works but is not the nice way).

This is really minor doc update, I hope the exception can apply.

IMO the exception applies here.