in reply to system() function

see system_detached/Win32::ShellQuote

Replies are listed 'Best First'.
Re^2: system() function
by PriNet (Monk) on Feb 09, 2015 at 03:24 UTC

    Thanx Anonymous Monk, I studied what you proposed and came up with this:

    use Win32::ShellQuote(); use Win32::Process(); my(@Node_Exe_Location) = ['C:\Program Files\nodejs\node.exe']; my(@Child_Script_To_Run) = [ 'node', 'I:\HTTPS\prinet.org\site\assets\javascript\child-module.js' ]; Win32::Process::Create( $Child_Module, Win32::ShellQuote::quote_system_string(@Node_Exe_Location), Win32::ShellQuote::quote_system_string(@Child_Script_To_Run), 0, Win32::Process::DETACHED_PROCESS(), ".", ) or do { my($err) = int($!).' '.$!." #### ".int($^E)." $^E "; warn "??? - CreateProcess failed $err "; };


    I have tried several variations of single quote, double quote, escaped and non-escaped slashes/back slashes to no avail. The closest I have got is the above code, but I'm getting "??? - CreateProcess failed 0 #### 123 The filename, directory name, or volume label syntax is incorrect" in the error log. I seriously appreciate your direction, but I'm having trouble understanding the syntax somehow. I'm assuming that "Win32::Process::DETACHED_PROCESS()" is something I wasn't aware of and that is one of the keys to what I'm attempting, but the "Win32::ShellQuote()" is what I'm misunderstanding somehow. Could you enlighten me a wee bit more? Oh, yea, thank you for what you provided, I'm going to keep experimenting here...
    -Gary


    I tried re-inventing the wheel again, but everytime I push it, it still falls flat on it's side...
      You use quote_system_string, but you don't use system. quote_native sounds more appropriate.