I have encountered a frustrating error that stops me from editing and testing a script in Windows XP SP2. I would like to know whether anyone has encountered the same thing and whether it can be fixed.

I have just re-installed Perl and restored my data as I had to get a new hard disk following the failure of my old one. The software image is provided by my company and is Windows XP service pack 2 with the latest security updates. I have installed the latest vesrion of Activestate Perl (v5.8.8).

When it comes to development, my method of working is to edit the script and then test it in a command prompt (CMD.EXE) before making changes and testing again using the same instance of the command prompt. The problem surfaced when I tried to save the changes to the script and my editor told me that the file was locked (file unavailable or readonly) by another process.

I have done a fair bit of investigation and come up with the following:

  1. The problem is limited to a script executed via the extension association. Running myscript.pl at the command line will lock the source file. If I use perl myscript.pl there is no problem.
  2. The script itself runs as expected even though the source cannot be edited.
  3. I have tested various other situations where the file association is used (E.g. running the script from Explorer) and not had a problem.
  4. The source file is locked (reported as readonly) until the CMD.exe instance is closed.
  5. The inability to edit has been verified with standard tools such as notepad and edit in order to remove the editor form the problem.

The only concludion that I can draw is that CMD.EXE is somehow holding on to the file after it has been executed in the way described.

Is anyone else able to reporoduce this issue? Although, I can work around the problem but I am finding it particularly frustrating!

cheers


In reply to command prompt locks scripts for editing by inman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.