yanne / api-test

0 stars 0 forks source link

"Read Until Prompt" only returns the last line of the output #84

Open yanne opened 10 years ago

yanne commented 10 years ago

System Info:

Problem Description:

Hi

When I execute the following commands I intend to check the status of a service Write service crond status ${output}= Read Until Prompt

I expect to obtain the following output (which is the one showed on the putty console) in order to see if it contains the word "running":

 INFO : ${output}= crond (pid  12410) is running...
 INFO : [root@server~]#

But I always obtain only the last line of the output, the Prompt:

 20130913 22:13:00.241 :  INFO : Writing u'service crond status'
 20130913 22:13:00.241 :  INFO : service crond status
 20130913 22:13:00.351 :  INFO : [root@server ~]#
 20130913 22:13:00.351 :  INFO : ${output} = [root@server ~]#

How can I ignore newlines that exist on the output so I can retrieve the whole output text?

Thanks in advance Best Regards Rita.

This issue was originally opened at Google Code on Sep 17, 2013.

yanne commented 10 years ago

Original comment by pekka.klarck on Nov 13, 2013.

Read Until Prompt definitely should be able to read multiple lines of output. There are at least two things you should check:

1) How is your prompt set? If it's not correct, reading until it won't work correctly either.

2) Do you possibly have some output with prompts in the output buffer when you Write? If that's the case, your Read Until Prompt will read to the first prompt in the output. You can use plain Read to clear the output buffer if needed.

Finally, if you don't need to have an interactive session otherwise, it might be easier to use Execute Command instead of Write/Read.