Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7764809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:00:42+00:00 2026-06-01T15:00:42+00:00

In a perl script invoked by nginix/ FCGI , if I do this ssh

  • 0

In a perl script invoked by nginix/ FCGI , if I do this ssh user@ip <command>, it works i.e. ti connects to remote machine
However, if I do this expect->spawn(ssh user@ip ), FCGI returns an error on doing a open (That code is pretty generic and I don’t expect bugs in it).If I run the script using expect as a standalone, it works.
That leads me to believe that FCGI perhaps does not allow process to be spawned by expect. Though I am not sure. Googling has not helped so far. Any inputs appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:00:43+00:00Added an answer on June 1, 2026 at 3:00 pm

    The reason it fails is because Expect.pm tries to dup STDIN and FCGI.pm doesn’t support the operation, next release of FCGI.pm will have a more clear error message than: Not a GLOB reference at /path/to/perl/lib/....

    The solution is to avoid using the globals: STDIN, STDOUT, STDERR and %ENV when doing inter-process communication.

    my ($stdin, $stdout, $stderr, $env) =
      (IO::Handle->new, IO::Handle->new, IO::Handle->new, {});
    
    my $r = FCGI::Request($stdin, $stdout, $stderr, $env)
      or die "Couldn't create FCGI request: '$!'";
    
    while ($r->Accept >= 0) {
        my $exp = Expect->spawn('ssh', 'user@ip')
            or die "Cannot spawn command: $!\n";
        print $stdout "OK\n";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My perl script is slow but works. I am considering throwing it out and
The Perl script that contains a Unix command to grep the ethernet NICs cannot
Has anyone run perl script given at http://oreilly.com/pub/h/974#code ? This is a famous one,
For a Mac OS X app where a Perl script (Markdown.pl) will be invoked,
My delicious-to-wp perl script works but gives for all weird characters even weirder output.
I've got a Perl script that needs to execute another Perl script. This second
I have a script that takes a command and executes it on a remote
I have a perl script that grabs some files from a remote server and
Perl script needs to receive ajax request, send a success message back to browser,
I have a Perl script that I'm attempting to set up using Perl Threads

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.