| Proc :: Safeexec. ´Ù¾çÇÑ ¹æ¹ýÀ¸·Î ¿ÜºÎ ¸í·ÉÀ» ½ÇÇàÇÏ´Â Æí¸®ÇÑ À¯Æ¿¸®Æ¼. |
Áö±Ý ´Ù¿î·Îµå |
Proc :: Safeexec. ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À̸§:
- Leif Pedersen
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~bilbo/
Proc :: Safeexec. ű×
Proc :: Safeexec. ¼³¸í
´Ù¾çÇÑ ¹æ¹ýÀ¸·Î ¿ÜºÎ ¸í·ÉÀ» ½ÇÇàÇÏ´Â Æí¸®ÇÑ À¯Æ¿¸®Æ¼. proc :: safeexecÀº ´Ù¾çÇÑ ¹æ¹ýÀ¸·Î ¿ÜºÎ ¸í·ÉÀ» ½ÇÇàÇϱâÀ§ÇÑ Æí¸®ÇÑ À¯Æ¿¸®Æ¼ÀÔ´Ï´Ù. Proc :: SafeeXecÀ» »ç¿ëÇÕ´Ï´Ù. $ Command = New proc :: safeexec ({#ÀÌ Áß Çϳª¸¦ ¼±ÅÃÇϽʽÿÀ. exec => , # exec () Æ÷Å© => 1, # ¹Ýȯ Æ÷Å© ÈÄ ÀÚ³àÀÇ undef. # °¢°¢ ĸóÇÒÁö ¿©ºÎ¸¦ ÁöÁ¤ÇϽʽÿÀ. # ±âÁ¸ # dupÀ» »ç¿ëÇÏ¿© ÆÄÀÏ ÇÚµéÀ» ÁöÁ¤ÇϽʽÿÀ. »õ ÆÄÀÏ ÇÚµé, "±âº»°ª"¶Ç´Â Undef #Àº ºÎ¸ðÀÇ ¼³¸íÀÚ¸¦ À¯ÁöÇϱâ À§ÇØ »õ ÆÄÀÏ ÇÚµé, "±âº»°ª"¶Ç´Â Undef #À» ÀÛ¼ºÇÏ¿© ºÎ¸ðÀÇ ¼³¸íÀÚ¸¦ À¯ÁöÇϰųª ÇØÁ¦ÇÕ´Ï´Ù. "´Ý±â"¸¦ ´ÝÀ¸½Ê½Ã¿À. stdin => * input_pipe, stdout => * output_pipe, stderr => "new", # ±âŸ ¿É¼Ç. child_callback => fref, # fork () ÈÄ¿¡ ¾ÆÀ̸¦ È£Ãâ ÇÒ ±â´ÉÀ» ÁöÁ¤ÇϽʽÿÀ. ¿¹Á¦, ±ÇÇÑÀ» »èÁ¦ÇÕ´Ï´Ù. debug => 1, # ½ÇÇà ¸í·É°ú °°Àº °æ°í¸¦ ÅëÇØ ÀϺΠÁ¤º¸¸¦ ¹æÃâÇÕ´Ï´Ù. NO_AUTOWAIT => 1, # $ COMMAND-> WAIT ()´Â $ COMMAND-> WAIT ()¸¦ »èÁ¦ÇÏÁö ¾Ê½À´Ï´Ù. REAL_ARG0 => "/ bin / ls", # ½ÇÇàÇÒ ½ÇÁ¦ ÆÄÀÏÀ» ÁöÁ¤ÇϽʽÿÀ. UNTAIN_ARGS => 1, # exec'ing Àü¿¡ Àμö¸¦ ¹ÌÄ¥ ¼ö ÀÖ½À´Ï´Ù.}); PRINTF "¾î¸°ÀÌÀÇ PID´Â % SÀÔ´Ï´Ù ", $ Command-> Child_PID () $ Command-> Child_PID (); WAIT ¸Þ¼Òµå°¡ ÀÚ½ÄÀÌ Á¾·áµÇ°Å³ª ÀÌ¹Ì Á¾·áµÇ´ÂÁö ¿©ºÎ¸¦ È®ÀÎÇϰųª È®ÀÎÇÕ´Ï´Ù. $ COMMAND-> WAIT (¿É¼ÇÀÇ ¼±ÅÃÀû Çؽà => 1, # "»õ·Î¿î"ÆÄÀÏ ÇÚµéÀ» ´ÝÁö ¸¶½Ê½Ã¿À. nonblock => 1, # Àڳడ Á¾·áµÇÁö ¾ÊÀº °æ¿ì ±â´Ù¸®Áö ¸¶½Ê½Ã¿À (no_close¸¦ ÀǹÌÇÕ´Ï´Ù).}); ¾ÆÀÌ¿Í Åë½ÅÇÏ·Á¸é # perlÀº ÀÌÇØÇÏÁö ¸øÇÕ´Ï´Ù. <$ command-> stdout ()>. my $ command_stdout = $ command-> stdout (); my $ command_stderr = $ command-> stderr (); $ line = <$ command_stdout>; $ line = <$ command_stderr>; Àμâ {$ Command-> stdin ()} "mumble "¾ÆÁ÷ ¾ÆÁ÷ ÃⱸÇß´ÂÁö ¿©ºÎ¸¦ È®ÀÎÇÏ·Á¸é :"Á¾·á »óÅ Àμâ : ", $ Command-> exit ()," "$ Command-> ´ë±â ({nonblock => 1}); exit : $ Command-> Wait ();"Á¾·á »óÅ : ", $ Command-> Exit_Status ()," "$ OUTPUT =`exec` ´ë½Å¿¡ Æí¸®ÇÑ ºü¸¥ µµ±¸ =`@ exec` : ($ Ãâ·Â, $?) = proc :: safeexec :: backtick (@exec); ¿ä±¸ »çÇ× : ¡¤ Perl.
Proc :: Safeexec. °ü·Ã ¼ÒÇÁÆ®¿þ¾î