planetwars-python-kit icon indicating copy to clipboard operation
planetwars-python-kit copied to clipboard

Bot doesn't stop after stdin is closed.

Open gordon-quad opened this issue 15 years ago • 6 comments

Bot still running after controlling program closes stdin.

gordon-quad avatar Sep 11 '10 21:09 gordon-quad

How are you noticing that? The game engine should kill the bots after a match is finished.

In other words what happens that should not happen or vice versa?

ulope avatar Sep 11 '10 21:09 ulope

I think this is due that I running it from shell script. bot.sh containg following: python MyBot.py --log mybot.log

command: LANG=en_US java -jar tools/PlayGame.jar maps/map7.txt 2000 20 log.txt "./bot.sh" "java -jar example_bots/BullyBot.jar" >/dev/null ; sleep 1 ; ps ax|grep MyBot |grep -v grep Turn 1 [...] Turn 21 Player 1 Wins! 24025 pts/4 R 0:01 python MyBot.py --log mybot.log

gordon-quad avatar Sep 11 '10 21:09 gordon-quad

Yep. When I run PlayGame with "python MyBot.py" it was killed. But I think it is a bit abnormally to continue running when parent process is killed.

gordon-quad avatar Sep 11 '10 21:09 gordon-quad

What happens if you run one of the example bots through a script. Does it terminate or also continue running?

ulope avatar Sep 11 '10 21:09 ulope

$ rm mybot.log ; LANG=en_US java -jar tools/PlayGame.jar maps/map7.txt 2000 20 log.txt "python MyBot.py --log mybot.log" "./bot2.sh" >/dev/null ; sleep 1 ; ps ax|grep BullyBot | grep -v grep Turn 1 [...] Turn 21 Player 1 Wins!

Java bot was terminated well. bot2.sh: java -jar example_bots/BullyBot.jar

gordon-quad avatar Sep 11 '10 21:09 gordon-quad

Hm I'm not really sure what I can do here. AFAIK I'm not doing anything in my code that would prevent it from being killed...

ulope avatar Sep 12 '10 21:09 ulope