in reply to exec() fails with strange message

What have you done to try to debug it? If it were me, I think the first thing I would do would be to show the command I'm about to execute.

In your code you invoke system2() like this:

system2($cmd,\$er,\$stdouttxr,\$stderrtxr);

But in system2() you unpack the arguments like this:

my $er = shift; my $cmd = shift; my $stdouttxr = shift; my $stderrtxr = shift;

Learning how to debug straightforward things, for example by confirming the things that "can't possibly be wrong", will take you a big step forward. :)

Replies are listed 'Best First'.
Re^2: exec() fails with strange message
by dissident (Beadle) on May 17, 2024 at 22:21 UTC
    Thank you!
    The lack of sleep takes its toll... -.-
    Yes, with a debug print command I'd have noticed that I changed the order of arguments in the function... *facepalm*
    Now it works like as it should, with arguments in the subroutine and its call in the same order, and without the exec.
    I guess my error somehow made Perl call sh instead of sending the command to execvp directly, leading to the confusing message.