Problem closing app that was launched via Telnet

M

mike_cole

I am hoping someone here can help me find a way around this problem.
Here is my setup: I have a Perl script residing on a Win2003 machine.
The Perl script will start a console app and some time later will send
a ctrl-c to the console app in order to close it down in an orderly
fashion. It accomplishes this by finding the window with the title of
the app, bringing that window to the foreground and sending the ctrl-c.
This works fine when I kickoff the script from that machine, but when I
telnet into the machine and kick off the script via telnet, it no
longer works. I believe this is because when I launch the app via
Telnet, a process is started but a window is not created for that
process. I don't want to kill the process since this may leave things
in a messy state afterwards. Sending a ctrl-c allows the console app to
cleanup before it closes. Does anybody know a way around this?

Mike
 
A

Anno Siegel

I am hoping someone here can help me find a way around this problem.
Here is my setup: I have a Perl script residing on a Win2003 machine.
The Perl script will start a console app and some time later will send
a ctrl-c to the console app in order to close it down in an orderly
fashion. It accomplishes this by finding the window with the title of
the app, bringing that window to the foreground and sending the ctrl-c.
This works fine when I kickoff the script from that machine, but when I
telnet into the machine and kick off the script via telnet, it no
longer works. I believe this is because when I launch the app via
Telnet, a process is started but a window is not created for that
process. I don't want to kill the process since this may leave things
in a messy state afterwards. Sending a ctrl-c allows the console app to
cleanup before it closes. Does anybody know a way around this?

This has nothing to do with Perl and everything with your OS.

In Unix you'd send an INT signal to the process. That does exactly
the same as hitting ^C and is less roundabout. In Win2003, I don't
know.

Anno
 
L

l v

I am hoping someone here can help me find a way around this problem.
Here is my setup: I have a Perl script residing on a Win2003 machine.
The Perl script will start a console app and some time later will send
a ctrl-c to the console app in order to close it down in an orderly
fashion. It accomplishes this by finding the window with the title of
the app, bringing that window to the foreground and sending the ctrl-c.
This works fine when I kickoff the script from that machine, but when I
telnet into the machine and kick off the script via telnet, it no
longer works. I believe this is because when I launch the app via
Telnet, a process is started but a window is not created for that
process. I don't want to kill the process since this may leave things
in a messy state afterwards. Sending a ctrl-c allows the console app to
cleanup before it closes. Does anybody know a way around this?

Mike

I _thought_ the lanched command window would automatically close when
the console app exited. At least I've seen this work on Win2k. I have
not verified that on Win2003. However, can you start the concole app
from a batch file with the last line being the 'exit' command? This
might close the hidden console window.

Len
 
M

mike_cole

I _thought_ the lanched command window would automatically close when
the console app exited. At least I've seen this work on Win2k. I have
not verified that on Win2003. However, can you start the concole app
from a batch file with the last line being the 'exit' command? This
might close the hidden console window.

Len

Len,

I am currently trying something along those lines that seems to work.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top