screen-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[screen-devel] [bug #32623] Problem with stuff command


From: anonymous
Subject: [screen-devel] [bug #32623] Problem with stuff command
Date: Thu, 21 Apr 2011 09:07:13 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; FEB90D29-EC84-23BE-1645-712B63F5096A; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

Follow-up Comment #1, bug #32623 (project screen):

This issue seriously limit's screen automation. Moreover the 'stuff', 'exec',
'kill' -X commands.
I'm reproducting this problem on FreeBSD 6.4-STABLE and Linux
2.6.26-2-686-bigmem.

I've get to a workaround - reattaching the screen using 'screen -r' and
detaching makes the screen session back controllable.

Example of problem reproduction and workarounds

"I want to spawn 'man ls' and leave running in a screen session"

#10 Create screen session (assume no 'test' sessions exist)
$ screen -d -m -S test
#20 ...but the following will have no effect no mater how many
# times repeated ('stuff' also fails):
$ screen -S test -X exec man ls <RETURN>

#30 But reattaching (as bg job to keep control) and detaching...
#BUG? But sometimes no screen is available to atach to!
$screen -S test -r & sleep 2 ; screen -S test detach <RETURN>
# ...will make the screen controllable!

#40 Now, it works!
$ screen -S test -X exec man ls <RETURN>

So workaround is like this:
$ screen -d -m -S test; screen -S test -r & sleep 2 ; screen -S test detach;
screen -S test -X exec man ls
 
But if I want to spawn screen and leave it running with 'man ls' on a remote
machine using a script that is calling ssh the key workaround part 'screen -S
test -r' will not succeeed because "Must be connected to a terminal", even
'ssh -t', 'ssh -tt' will not help.

So, I spawn ssh in local screen and control this screen in order to execute
desired remote commands via ssh. To spawn command in a local screen from
script I need to use the above workaround.
Finally the local obolete session should be closed but single -X kill command
has no effect... somehow repeated twice succeeds

$ screen -m -d -S test;sleep 2;screen -S test -r&sleep 1;screen -S test -X
detach;screen -S test -X exec ssh address@hidden; sleep 4;screen -S test -X
stuff "screen -m -d -S test;screen -r&sleep 1; screen -S test -X detach;
screen -S test -X exec man ls"$'x0D'; sleep 2; screen -S test -r&sleep
2;screen -S test -X detach;echo killing;screen -S test -X kill; screen -S test
-X kill 

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?32623>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]