in reply to 'system' not working!

The quotes to "escape" spaces in file names are only required when the file name is part of a command line that is going to be split on spaces. The indirect object to system is not part of the command line so drop the quotes. That makes it work for me.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: 'system' not working!
by John M. Dlugosz (Monsignor) on Oct 25, 2001 at 03:10 UTC
    That makes it break differently for me. I took out the quotes, and get
    Unrecognized command: Files\Microsoft
    which is why I added the quotes in the first place.

    It also shows that I get a different error for a genuine "not found", as opposed to a not-found making it look for CMD as a fallback... hmm, maybe it's a read herring, and the error is from VS.exe itself, not from Perl! I'll explore that.

    (Meanwhile, why does it work for you without the quotes?)

    —John

      Okay, I even went out of my way and renamed some things so that I had spaces in my path but that didn't change my results. This type of stuff has changed between versions of Perl so perhaps that explains our different results. I was doing this testing using v5.6.0 ActivePerl build 616.

      I suspect that Perl's 'if CreateProcess() fails, then just retry with CreateProcess("cmd.exe","/c ...",...)' logic is masking the real error here. I'd think that using an indirect object with system would disable that logic, but I haven't checked that.

      In any case, you can always do:

      use Win32; $vss= Win32::GetShortPathName( "D:\\Program Files\\" . "Microsoft Visual Studio\\Common\\VSS\\win32\\ss.exe");
      and I'm pretty sure that will fix errors due to spaces in file names.

      You also might want to try Win32::Process to see if you can reproduce why Perl thinks CreateProcess() is failing.

              - tye (but my friends call me "Tye")
        This type of stuff has changed between versions of Perl so perhaps that explains our different results

        That pretty much conferms that it broke between versions, which is why my script no longer runs.

        I looked into the logic a short time ago when I posted the details of PERL5SHELL (or whatever it's called) for nonbeleivers. But that was after it already decided to use the shell.