INFO : ${result} = <result object with rc 1> if I use run process to execute a shell script

2,331 views
Skip to first unread message

Sahil Sharma

unread,
Oct 13, 2017, 8:51:57 AM10/13/17
to robotframework-users
Hi Guys,

I have just started working on Robot and have very little idea of python too. 
So I created a shell script to complete my task on a linux system.

When I execute the script on the linux system itself , it works flawlessly .
But when I try using Robot I am unable to retrieve any information ( I used Run Process , Execute Command , Start Process etc ) in each case I get either "command exited with return code 127" or "command exited with return code 1"
Ill just put in what I have written on ride

1st CASE

open connection 1xx.xxx.xx.xx
Login user passwd
${result} = Run Process fillrcv.sh argument shell=true
Should Be Equal ${result.stdout} SUCCESS for(text i need in the result)
OUTPUT
20171013 18:01:15.755 :  INFO : Waiting for process to complete.
20171013 18:01:15.896 :  INFO : Process completed.
20171013 18:01:15.896 :  INFO : ${result} = <result object with rc 1>
20171013 18:01:15.911 :  FAIL :  != SUCCESS for
Ending test:   AUTOMATION THROUGH ROBOT.Wte

Another case
open connection 135.249.91.13
Login ainet ainet1
Execute command fillrcv.sh c

OUTPUT
20171013 18:11:08.890 :  INFO : Executing command 'fillrcv.sh c'.
20171013 18:11:08.906 :  INFO : Command exited with return code 127.
Ending test:   AUTOMATION THROUGH ROBOT.TC2

Not sure , what to do .. I was unable to find how to use environment variable , so I included the base path for all in built commands like grep sed awk etc. but to no avail .
I have been trying things for almost a week now.

Could you please help?

Regards,
Sahil

Hélio Guilherme

unread,
Oct 13, 2017, 9:03:45 AM10/13/17
to robotframework-users
Well, you did not say what Library are you using. I'll assume that it is SSHLibrary.

The Run Process keyword is running on the host system where you run robot. You probably want to run the script on the remote server where you connect and logged in. For that, you need to make sure the script is there (probably by uploading it just when needed), and use normal SSHLibrary keywords to Write and Read commands output.




My Favorite Open Source Projects
awsome-lists gretl meld robotframework wxPython
(sponsored/patrocinado) Recomendo servidores e alojamento Web em:
http://www.proalojamento.com/clientes/aff.php?aff=258

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Sahil Sharma

unread,
Oct 13, 2017, 9:39:46 AM10/13/17
to robotframework-users
Hi,

Thanx for the input. I was just about to update my wuestion . you are right , I used Write and Read and it was bang on target .
But I am stuck at an issue , I am using 

Write sh fillrcv.sh c
Set Client Configuration prompt=#
${output}= Read Until Prompt

which fails after 3 seconds

Login user passwd
Write su root
Write rootpasswd
Write sh fillrcv.sh c
${output}= Read Until Regexp .*good bye.*

same is the case for Read Until Regexp . 
I tried increasing the timeout to 120s or 2 minute but to no use , as Read is not taking a timeout argument . Any suggestions how to implement a bigger timeout for this case?
Really appreciate your help. 

Regards,
Sahil
To post to this group, send email to robotframe...@googlegroups.com.

Hélio Guilherme

unread,
Oct 13, 2017, 9:54:31 AM10/13/17
to robotframework-users
I "think" that the prompt should be defined before the connection.

Does the timeout really exist when you perform manually the steps?

Would you improve your strategy of running commands like `root` user? For example using the "su -c" to run the command at once.
Or adding your user to SUDOERS to not have to use a password (for the specific command, or all).

There is a workaround for problematic timeouts, which is using: Wait Until Keyword Succeeds

Good luck

To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsubscrib...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages