RE: [JSch-users] Application not exiting
Status: Alpha
Brought to you by:
ymnk
From: Chandolu, Y. <YCh...@ar...> - 2006-02-28 15:59:47
|
Thank you so much Atsuhiko. It worked like a charm. Thanks again for immediate reply. -Yuva -----Original Message----- From: Atsuhiko Yamanaka [mailto:ym...@jc...]=20 Sent: Tuesday, February 28, 2006 12:50 AM To: Chandolu, Yuva Cc: jsc...@li... Subject: Re: [JSch-users] Application not exiting Hi, +-From: "Chandolu, Yuva" <YCh...@ar...> -- |_Date: Mon, 27 Feb 2006 20:55:35 -0000 ___________ | |I am using ChannelExec to run a command remotely. I have attached code |at the very end. I ran the program in command prompt and the problem is |after I run the program it does not exit. I have to press <ctrl>+c for |the program to exit. I have taken the code from examples on the site. |Please suggest what should I do for the program to exit gracefully. ... | Session session=3Djsch.getSession("user", "host", 22); | session.setTimeout(31000); | UserInfo ui=3Dnew MyUserInfo(); | ui.setPassword("password"); | session.setUserInfo(ui); | session.connect(); | Channel channel=3Dsession.openChannel("exec"); | ((ChannelExec)channel).setCommand("mycommand"); If X server is not running, setXForwarding should not be enabled. | /* channel.setXForwarding(true); */ How about comenting out next line? | /* channel.setInputStream(System.in) ;*/ You will use getInputStream, so setOutputStream should not be invoked. | /*channel.setOutputStream(System.out);*/ | channel.connect(); | InputStream in =3D3channel.getInputStream(); Sincerely, -- Atsuhiko Yamanaka JCraft,Inc. 1-14-20 HONCHO AOBA-KU, SENDAI, MIYAGI 980-0014 Japan. Tel +81-22-723-2150 +1-415-578-3454 Fax +81-22-224-8773 Skype callto://jcraft/ |