in reply to pp --clean does not seem to work

pp --clean does not seem to work ... no proof ...

You're confused, --clean works

when pp is creating an executable , it putts stuff into temp, this is what you're confusing for --clean not doing its job

$ rm -rf goner-temp $ md goner-temp $ set TEMP=goner-temp $ set TMP=goner-temp $ findrule goner-temp |wc --lines 1 $ pp --clean coy.pl $ findrule goner-temp |wc --lines 109

Running the executable doesn't increase the number of files in temp, this means --clean is working

$ a.exe 1>NUL 2>NUL $ findrule goner-temp |wc --lines 109

Emptying temp, and running the executable shows no files in temp

$ rm -rf goner-temp $ md goner-temp $ findrule goner-temp |wc --lines 1 $ a.exe 1>NUL 2>NUL $ findrule goner-temp |wc --lines 2

Without --clean option the number of files doubles after running the executable

$ rm -rf goner-temp $ md goner-temp $ pp coy.pl $ findrule goner-temp |wc --lines 109 $ a.exe 1>Nul 2>NUL $ findrule goner-temp |wc --lines 220

--clean worked as designed, its working

Could it be that it works on windows and is broken on linux? Not likely -- now you know how to check

Replies are listed 'Best First'.
Re^2: pp --clean does not seem to work (it does)
by hellosarathy (Novice) on Dec 14, 2015 at 09:03 UTC
    Thanks Monks,

    I just ran few tests and realised that --clean works on 'normal' conditions. The temp-xxx is cleaned after normal exit.

    However, if the script crashed or killed for whatsoever reason, the temp-xxx contents are retained and not cleaned up. So probably have to deal that separately, like, to clean up explicitly in an END block or so...

      I just tried both a die() and a divide by zero in my test script and both times the contents of Temp\par-123... were cleared out. I'm testing on Windows. How are you killing the process?

        How are you killing the process?

        On unix systems, kill -9 (i.e. sending SIGKILL) can not be caught, the process is terminated without a chance to save any data or to clean up. See also signal(7) and POSIX.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)