perl - I have used below code to check single instance of replace.exe is running -


I used the code below to see the single example of replace.exe. When I substitutes. Exe and windows go on, having another file with name 0 kb size (without any extension) is being replaced.

I do not think that file should be created and I want to automatically delete the file after the replace.exe execution.

Please help me

Use FCTL QW (: Flock); # Check that any example of this script is already running $ lock = "replace"; Sub lockout () (& print_log ("An example of this script is running, so it is exiting, please try after some time."); Print "The example of this script is going on, so it is going out Please try again after some time. "; Exit 1;} Open (my $ PID, '& gt;' $ lock); Swarm ($ pid, LOCK_EX | LOCK_NB) or lockout ();

I think you are working with a Perl script which is somehow a window Executionable and you want to run it in an example.

You can try the following:

  Use Fcntl qw (LOCK_EX LOCK_NB LOCK_UN); if (! Swarm figure, LOCK_EX | LOCK_NB) {Print STDERR "is already running ... going out ... ... \ n"; go out;} ######## __DATA__Don't delete this data The block will be locked by a single-instance argument, it will be stopped from locking more than once.   

In a perlscript, __DATA__ blocks are special Areas can be locked, but I do not know what reserves your script compiler that feature.

If such a thing does not work, you can understand the executable file name and lock one instead, it should do the same thing as locking a file called 'substitution' .

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -