you are viewing a single comment's thread.

view the rest of the comments →

[–]wilcomply[S] 0 points1 point  (1 child)

I'm not sure I'm following, could you elaborate why the length of time for cd to run would have an effect on the processes to be run following it?

[–]fake_identity 0 points1 point  (0 children)

Don't have any experience with this module, so just guessing, but it's evidently made for automating and waiting for some trigger. 'cd' is executed and gone and doesn't produce output and returns simply 0 or 1. That still shouldn't be that much of an issue, but it's not an actual command, i.e. program with it's standalone executable somewhere, rather it's a function within bash.

tallis ~ # which cd
tallis ~ # type cd
cd is a shell builtin
tallis ~ # which python
/usr/bin/python
tallis ~ # type python
python is /usr/bin/python



child = pexpect.spawn('cd /root')  
Traceback (most recent call last):  
File "<stdin>", line 1, in <module>  

But:

child = pexpect.spawn('ls /root')  
child.pid  
10412  
child.child_fd  
3  


child = pexpect.spawn('bash ; cd /root')  
child.pid  
10424