milo
(M)
June 10, 2021, 7:20am
1
Hello,
I try to get the return value of the execute command line command.
var response = executeCommandLine("sudo","reboot")
loginfo("w", response.toString)
to check if everything is fine. But error is “‘toString’ is not a member of ‘Object’”
Regards
rossko57
(Rossko57)
June 10, 2021, 9:32am
2
variable response
should already be a string. I’ve never seen string.toString
cause an error though; are you sure that is the offending line?
milo
(M)
June 10, 2021, 10:18am
3
It is the line yes…I am on oh3.1 M5 build
rossko57
(Rossko57)
June 10, 2021, 10:20am
4
If it really is an object, you should get a better view with
loginfo("w", "my response {}", response)
rlkoshak
(Rich Koshak)
June 10, 2021, 3:29pm
5
You have to supply a java.time.Duration as the first argument to tell executeCommandLine the maximum amount of time to wait before timing out. Without that executeCommandLine returns immediately before the called script returns.