Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

LD_PRELOAD without shell

by hel1os (Initiate)
on Apr 22, 2013 at 11:29 UTC ( #1029845=perlquestion: print w/replies, xml ) Need Help??
hel1os has asked for the wisdom of the Perl Monks concerning the following question:

Hello I use some command-line soft, running it with IPC::Open2
$pid = open2($co, $ci, "./progname", "--option1", "--option2", "$param +");
It's necessary to start it without shell(i need real PID) But I need to preload some lib. Adding "LD_PRELOAD" to "./progname" don't work without using another form of open, which run shell:
$pid = open2($co, $ci, "LD_PRELOAD=./blah.so ./progname --option1 --op +tion2 $param");
Is there a way to preload lib without running shell?

Replies are listed 'Best First'.
Re: LD_PRELOAD without shell
by Corion (Pope) on Apr 22, 2013 at 11:35 UTC

    Have you looked at %ENV? In what way did it fail to work?

    As an alternative, have you tried

    LD_PRELOAD=./blah.so exec ./progname --option1 --option2

    ... to keep the "real" PID?

      is %ENV global for perl and another progs running from it?

      but exec works fine, thanks

        From the linked documentation:

        Setting a value in ENV changes the environment for any child processes you subsequently fork() off.

        I'm sure it could be less specific on fork(), but the part about "any child processes" is still true.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1029845]
Approved by herveus
help
Chatterbox?
[stevieb]: I'm having issues finding an arduino library that does the right thing for my gps... five hours now. I'm going to just write my own parser

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2017-05-28 17:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?