Gracious Monks -

I've tired of the monotony of transferring files and node-hopping in our complex environment from my WinXP workstation, so I've begun scripting solutions. It's got a Win32::GUI interface (due to Tk conflicts) and am using IPC::Run to interact with plink and pscp (command line SSH/SCP programs). Plink works perfectly; as I began scripting pscp, I've come across an oddity. If the file I want to transfer is not in the directory as the script, IPC::Run fails, citing "caught Bad file descriptor: Win32::Process::Create() at C:/Perl/site/lib/IPC/Run.pm line 2799".

The error occurs with the file selection; not even in passing the file to IPC::Run (meaning, if I have a file selected that is not in the directory, IPC::Run's "start" will fail, even if the file reference isn't passed or used by IPC::Run by that point in time). I'm imagining there is some conflict in the packages, but I'm clueless in troubleshooting this, and hoped someone had seen something like it before. Snippets below.

To select the file:
my $file = "\0" . " " x 256; $scpfile->Text(GUI::GetOpenFileName(-title=>'SCP',-file=>"\0" . " " x +256,-filter => [ "All files", "*.*" ]));
And the IPC::Run incantation:
my $host = $reds->GetString($reds->SelectedItem()); my @cmd = ( "pscp", "-pw", $redpass->Text(), Win32::GetShortPathName($ +scpfile->Text()), $userid.'@'.$host.':'.$redscp->Text() ) ; my ($in, $out, $err); my $h = start \@cmd, \$in, \$out, \$err, debug => 2; while ($out !~ /100/) {print $out;pump $h;} finish $h or die "returned $?";
Is there a conflict in these packages, or am I doing something foolish (besides poorly written code!)??

Thanks in advance...

In reply to IPC::Run and Win32::Process::Create by jpavel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.