4 ms·
There's no guarantee that the name and the path are still the same executable that is running, or that they even exist anymore.
by SoftTalker 2y ago
There's no guarantee that the name and the path are still the same executable that is running, or that they even exist anymore.
- mistercow 2y agoI mean sure. All software is built on assumptions. Make sure the assumptions you’re making are appropriate in context.
- wang_li 2y agoIn most of the variants of exec*() there are separate arguments for the thing to be executed and the *argv[] list. Argv[0] being the executable is just a convention. In perl $ARGV[0] is the first positional parameter. In $ perl myscript.pl a b c $ARGV[0] is "a".
- wongarsu 2y agoUnless you are on Windows
- glandium 2y agoYou can actually rename an executable that is running, on Windows. That's a way to handle self updates: rename the executable, create its replacement, execute the new one to make it remove the old executable.
- deleted 2y ago[deleted]