This is the mail archive of the
cygwin@sources.redhat.com
mailing list for the Cygwin project.
Re: Why does scp leave ssh running? -- select() never returns
- To: wpd at delcomsys dot com
- Subject: Re: Why does scp leave ssh running? -- select() never returns
- From: "Ehud Karni" <ehud at unix dot simonwiesel dot co dot il>
- Date: Mon, 8 Jan 2001 13:21:10 +0200
- CC: cygwin at cygwin dot com
- Organization: Simon & Wiesel Insurance agency
- References: <3A22C383.5C16BBC8@delcomsys.com> <3A25C7DA.6F76C8DA@delcomsys.com> <20001129224015.B21867@redhat.com> <3A266130.F5877EB5@delcomsys.com> <3A271DCD.99BDDBF5@delcomsys.com> <20001202200832.A18661@redhat.com> <3A29C260.1C491A30@delcomsys.com> <20001202233944.A19867@redhat.com> <3A2A16B5.E1C3F9F4@redhat.com> <3A351ADE.EF54C845@delcomsys.com> <20001211133605.B7497@redhat.com> <3A352393.4D8645EC@delcomsys.com> <3A57E0F0.3FE252BD@delcomsys.com>
- Reply-to: ehud at unix dot simonwiesel dot co dot il
On Sat, 06 Jan 2001 22:22:24 -0500, Patrick Doyle <wpd@delcomsys.com> wrote:
>
> I have been working on a hack workaround for this problem. (Short
> summary -- select() fails to detect when all of the writers of a pipe
> have closed the pipe because PeekNamedPipe() on W9x boxen fails to
> report when all of the writers of a pipe have closed the pipe. I am
> told that this all works correctly on NT/2K boxen).
My work around for Win95/98 is a bash script, executed directly from
the windows command (I associated sh with /bin/bash):
#! /bin/sh -ex
# --------------------------------------------------
set +e
scp -p -v -r -C "$1" ehud@ekc-1:$2
set +x
GRP=`ps | grep "[/]PS"` # find this PS line
GRP=`echo $GRP | cut "-d " -f3` # compress spaces
PID=`ps | grep $GRP | grep "[/]bin[/]SSH"` # My ssh line
PID=`echo $PID | cut "-d " -f1` # compress spaces
ps # show running processes
set -x
if [ "$PID" != "" ] ; then # is there "My SSH"
kill $PID # yes kill it
else
: " Error in copy to linux " # no, error message
fi
sleep 30 # keep console open
############################## scpt.sh ##############################
> Basically, I have modified 'pipe()' to create two windows pipes (on W9x
> boxen). The first pipe is the same one that has always been created.
> [ snip ]
Well, it seems a very complicated work around for the W9x bug. I would
have taken a much simpler and direct approach like this:
1) Save the child (ssh) process id in a global variable,
(i.e. child=fork() ;)
2) Just before exiting, send kill signal to the child with no
checks, (i.e. kill(child, SIGTERM) ;)
This might look like brute force, but it works. It has the advantage
that it works with ssh unmodified and with any other program that may
be given as argument to scp.
Ehud.
--
@@@@@@ @@@ @@@@@@ @ @ Ehud Karni Simon & Wiesel Insurance agency
@ @ @ @@ @ Tel: +972-3-6212-757 Fax: +972-3-6292-544
@ @ @ @ @ @@ (USA) Fax and voice mail: 1-815-5509341
@ @ @ @ @ @ Better Safe Than Sorry
http://www.simonwiesel.co.il mailto:ehud@unix.simonwiesel.co.il
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple