Conversation
In a proxy setting the process_id usually referring to the game instances is default initialized to 0. On Linux based systems `TerminateProcess(0)` will kill all processes within the bot's processing group, including the bot itself.
| for (auto& p : process_settings_.process_info) { | ||
| TerminateProcess(p.process_id); | ||
| if (p.process_id > 0) { | ||
| TerminateProcess(p.process_id); |
There was a problem hiding this comment.
Probably, you should put if (p.process_id > 0) inside TerminateProcess?
There was a problem hiding this comment.
True. I am trying to think of a case where you would want to use TerminateProcess(0) and I can't find any. So I would add this if... here instead and return false.
But @N00byEdge reacted with a thumps down. So maybe there is a reason to keep it there?
There was a problem hiding this comment.
If you really want to prevent such behaviour, it should be placed inside TerminateProcess.
To me 0 looks like not properly initialised object. However, there could be some logic around it or simply a error in the code (i.e. the id is not set when needed) but we don't see it because of the current behaviour of TerminateProcess.
Is it covered by unit tests somehow?
@KevinCalderone could you please shed the light on this implementation?
In a proxy setting the process_id usually referring to the game instances is default initialized to 0. On Linux based systems, during the destruction of the
sc2::coordinator,TerminateProcess(0)will kill all processes within the bot's processing group, including the bot itself. This is probably not intended behavior and can have unwanted side effects.