Dual-license your content for inclusion in The Perl 5 Wiki using this HOWTO, or join us for a chat on irc.freenode.net#PerlNet.

User:PJF/System

From PerlNet

Jump to: navigation, search

Under Win32 systems, the chain of calls for a system() command is as follows:

  • pp_sys.c : pp_system invoked
  • win32/win32.c : do_aspawn() invoked
    • do_aspawn appears to always want to use the shell.
  • win32/win32_spawnvp does the hard work
  • CreateProcess ultimately brings the process to life.

Alternatively, pp_sys.c may invoke do_spawn() from win32.c, under conditions I'm yet to interpret.

  • do_spawn invokes do_spawn2 in win32.c
  • do_spawn2 checks for shell metachars
  • If no metachars present, tries to execute the command directly.
  • If the command fails, or metachars present, tries to execute the shell with the given command.
    • This may be a bug, resulting in multi-arg system() invoking the shell.
  • win32_spawnvp still ultimately does the work
Personal tools