Issue
My question might duplicate this post stop python program when ssh pipe is broken but the only answers i could test(ssh -tt, ssh -t and ssh -T) didn't work for my case.
Here is the command i use in git bash to run a local python script over ssh on the raspberry pi:
ssh python3 < 01_LED.py
Here is the script content:
from gpiozero import LED
from time import sleep
def main():
red = LED(24)
while True:
red.on()
print('LED is on')
sleep(1)
red.off()
print('LED is off')
sleep(1)
main()
What i would like to get is this:
- Get all the script output in the local git bash terminal;
- Press CTRL-C to end the script locally and on the pi.
What is the simplest approach i could use to achieve this?
I'm fairly new to this topic so any detailed answers or documentation links would be greatly appreciated.
Thank you
Solution
In the end this solution worked for me: cat 01_LED.py | ssh python3 -u
Answered By - user13506452