I do not have a solution, but I may have narrowed the problem for you. I ran your example (without updates) on Windows 7. The second instance does run, but does not return to the command window until I type a return. I suspect (without any real reason) that the problem is related to terminal I/O. I modified you program to avoid it (Removed both print statements). In order to verify that the second instance actually ran, I added an open statement to create a file. The resulting program runs to normal completion. The presence of the zero-length file in my current directory verifies that the second instance ran. I have no idea if this applies to windows 10 or if it will be of any help with the original Tk problem.
#!/usr/bin/env perl
use warnings;
use strict;
my $pathToMyself = $0;
local $, = "\n\t* ";
local $\ = $/;
#print "\t".$^X, $0, @ARGV;
restartMe() unless @ARGV;
open my $foo, '>', 'UniqFileName.___'; # Look for file in CWD
sub restartMe {
# print "Restarting $pathToMyself...\n";
#exec( $^X, $pathToMyself ) or die "couldn't exec $pathToMyself: $
+!";
#system(1, $^X, $pathToMyself, "don't Restart", "final" ); exit;
#system(1, "cmd.exe", "/c", $^X, $pathToMyself, "final"); exit;
exec("cmd.exe", "/c", $^X, $pathToMyself, "final") or die "couldn
+'t exec $pathToMyself: $!";
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.