Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes not all child processes are ended by conrun-kill #1422

Closed
dlech opened this issue Jul 3, 2020 · 2 comments
Closed

Sometimes not all child processes are ended by conrun-kill #1422

dlech opened this issue Jul 3, 2020 · 2 comments

Comments

@dlech
Copy link
Member

dlech commented Jul 3, 2020

However, when I exit the program using the VSCode red-square stop button, the daemon process lives on -- when I press the Touch Sensor, the Motor continues to run -- even after VSCode shows: "Program ended by stop button. Completed successfully." I have to reboot the EV3 Brick to kill that process.

The fact that the subprocess is not being killed could be a bug in brickrun/console-runner.

Originally posted by @dlech in ev3dev/vscode-ev3dev-browser#103 (comment)

@dlech
Copy link
Member Author

dlech commented Jul 3, 2020

Test case:

#!/usr/bin/env python3


from ev3dev2.motor import MediumMotor, OUTPUT_A
from ev3dev2.sensor import INPUT_1
from ev3dev2.sensor.lego import TouchSensor

from multiprocessing import Process


TOUCH_SENSOR = TouchSensor(address=INPUT_1)
MOTOR = MediumMotor(address=OUTPUT_A)


def motor_on_when_touched():
    while True:
        if TOUCH_SENSOR.is_pressed:
            MOTOR.on_for_seconds(
                speed=100,
                seconds=1,
                brake=False,
                block=True)


Process(target=motor_on_when_touched,
        daemon=True).start()
# *** process still alive after program ended through VSCode ***


while True:
    pass
  • Run this program using the ev3dev VS Code extension.
  • Stop the program using the ev3dev VS Code extension.
  • Subprocess is still running

@dlech
Copy link
Member Author

dlech commented Jul 12, 2020

This is a VS Code extension bug after all.

@dlech dlech closed this as completed Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant