kill $pid;
You are missing an argument to kill. You need to specify the signal to send to the pid, either as a string , 'TERM' or 'KILL' or as a number: 2 or 9;
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
Sorry, but even with the 'KILL' parameter, it doesn't close the window. Maybe it only kill the process CMD, not iceweasel itself.
It is the same problem with 'system' function.
| [reply] |
my $pid = open CMD, '|-', qq[\"/full/path/to/iceweasel.exe\" -new-wind
+ow '$url'] or die $!;
close CMD;
...
kill 9, $pid; ## Any numeric value other than 2, 15 or 21 should work
+here.
That should start the command directly bypassing cmd.exe and return the pid of the program rather than a shell. It works with opera.exe, but I don't have iceweasel.
Things to note:
- The first part of the third argument to open should be the fully qualified path and name of the command to run.
- If the path contains spaces, then you must delimit it using escaped double quotes as shown.
- If any of the arguments contain spaces, you may have to delimit them in the same way.
- The usual *nix signals 'INT', 'TERM' & 'BREAK' don't work on Win32, but *any* other signal except 0, including those that would not be fatal under *nix, will be.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
Which OS are you on?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
my $url="http://www.google.fr/";
my $pid = open CMD, "iceweasel -new-window '$url' |" or die $!;
print "$pid\n";
sleep 10;
my $k=kill 'KILL',$pid;
print "$k\n";
close CMD;
the process is actually killed, but the window opened doesn't shut. | [reply] |