Click here to get back home

starting a background process via Net::SSH::W32Perl

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
starting a background process via Net::SSH::W32Perl Yishay Weiss 09-07-2004
Get Chitika Premium
Posted by Yishay Weiss on September 7, 2004, 10:41 am
Please log in for more thread options
Hi All,

I've not been able to start a background process using Net::SSH::W32Perl.

For example:

- - - -
use Net::SSH::W32Perl;

my $ssh = Net::SSH::W32Perl->new('host');
$ssh->login('user', 'passwd');
my $t1 = time;
$ssh->cmd('sh -c "sleep 10"&');
print "elapsed time: ".(time - $t1)."n";

- - - - -

elasped time: 10

- - - - -

I would expect it to be zero. Does anyone know of a workaround for this?

Thanks,
Yishay


Posted by Yishay Weiss on September 27, 2004, 2:55 am
Please log in for more thread options
To anyone interested, I've found the answer. You need to close STDIN,
STDOUT, STDERR before starting the process. So the following works:

use Net::SSH::W32Perl;

my $ssh = Net::SSH::W32Perl->new('host');
$ssh->login('user', 'passwd');
my $t1 = time;
$ssh->cmd(' <&; >&; 2>&; sh -c "sleep 10"&;'); # difference is here
print "elapsed time: ".(time - $t1)."n";

-----

elapsed time: 0


yishayjobs@hotmail.com (Yishay Weiss) wrote in message
> Hi All,
>
> I've not been able to start a background process using Net::SSH::W32Perl.
>
> For example:
>
> - - - -
> use Net::SSH::W32Perl;
>
> my $ssh = Net::SSH::W32Perl->new('host');
> $ssh->login('user', 'passwd');
> my $t1 = time;
> $ssh->cmd('sh -c "sleep 10"&');
> print "elapsed time: ".(time - $t1)."n";
>
> - - - - -
>
> elasped time: 10
>
> - - - - -
>
> I would expect it to be zero. Does anyone know of a workaround for this?
>
> Thanks,
> Yishay


Similar ThreadsPosted
Win32::Process, SetProcessAffinityMask for an existing process = perl crash May 7, 2006, 6:22 pm
SpreadSheet::Write Excel- Is there a way to set background color for entire worksheet? January 21, 2005, 12:56 pm
Win32::Process Kill Process in Windows ME April 13, 2005, 1:49 am
Starting a perl program when I connect to the internet. September 22, 2004, 3:34 pm
timeouts for Net::SSH::W32Perl January 27, 2005, 2:23 am
set_tty error from NET::SSH::W32PERL August 24, 2004, 7:52 am
Net::SSH::W32Perl Script hanging when trying to return data March 10, 2005, 1:14 pm
Net::SSH::W32Perl Script hanging when trying to return data March 10, 2005, 1:30 pm
Net::SFTP / Net::SSH::W32Perl strange debug messages? August 13, 2006, 11:06 am
starting apache with mod_perl, error on Apache.pm July 21, 2004, 5:34 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap