Cygwin Screen Reattach Workaround

In an earlier post I mentioned how I was using a VM for my irc usage. I was running GNU screen + irssi to keep a persistent connection so I can idle in channels.

I've been experimenting with using Cygwin to make my Windows 7 machine my SSH box. So I installed irssi + screen... Looks like everything is all good.

(BTW: If you use a terminal emulator and you haven't looked into GNU screen, I really recommend that you do.)

However, I've been bumping into issues with reattaching. After running both screen -DR and -DRR just hung there.

Quick search for a solution led me to this workaround

#!/bin/sh
# Send SIGHUP to each screen to force it to let go and let the server recover
ps -as | grep screen | cut -c4-7 | xargs kill -1
# Reattach
screen -xRR

This works for me. I'd like to not have to go through all the extra trouble, but it is pretty slick.