title: How to pass CTRL+C to Raspberry Pi terminal from Node-RED?
body: <p>I am creating a tutorial for visiting high school students.</p>
  
  <p>Using Node-RED I have a Raspberry Pi that runs a script written in python. I am looking to end the python script from node-RED by passing a keyboardInterrupt (CTRL+C) so that the script ends gracefully and the GPIO is cleaned up for the next run.</p>
  
  <p>I can run the script just fine by using the EXEC block in node-RED and passing "sudo python Documents/python/blinker.py" to the terminal. Problem is because I am not working directly in the terminal I cannot just use CTRL+C to exit the while loop. Is there a way to pass CTRL+C to the terminal from node-RED?</p>
  
  <p>I have attached the python code for those interested:</p>
  
  <pre><code>import RPi.GPIO as GPIO
  import time
  
  pwmPin = 18
  ledPin = 23
  butPin = 17
  
  dc = 95
  
  GPIO.setmode(GPIO.BCM)
  GPIO.setup(ledPin, GPIO.OUT)
  GPIO.setup(pwmPin, GPIO.OUT)
  pwm = GPIO.PWM(pwmPin, 50)
  GPIO.setup(butPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  
  GPIO.output(ledPin, GPIO.LOW)
  pwm.start(dc)
  
  print("Press CTRL+C to exit")
  try:
          while 1:
                  if GPIO.input(butPin):
                          pwm.ChangeDutyCycle(dc)
                          GPIO.output(ledPin, GPIO.LOW)
                  else:
                          pwm.ChangeDutyCycle(100-dc)
                          GPIO.output(ledPin, GPIO.HIGH)
                          time.sleep(0.075)
                          GPIO.output(ledPin, GPIO.LOW)
                          time.sleep(0.075)
  except keyboardInterrupt:
          pwm.stop()
          GPIO.cleanup()
  </code></pre>
  
  <p>I have tried using the kill and killall commands and that terminates the application but the GPIO.cleanup() isn't run then and any outputs that were on will remain on.</p>
  
  <p>I have also tried passing "echo $'\cc' | ./blinker.py" but get a premissions error.</p>
  
  <pre><code>/bin/sh: 1: Documents/python/blinker.py: Permission denied echo: write error: Broken pipe
  </code></pre>
  
  <p>Any help is appreciate</p>