0

How do i exit from a stdou.read() if the command that I executed enter in input mode?

Example:

p = subprocess.Popen('smbclient <IP>', stdout=subprocess.PIPE, shell=True)

if the command connect to the IP it will enter in the input mode for the smb but i only want to check if it connect or not

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • This just starts a subprocess, it's not stuck anywhere at all. If you just want to run the command, try `subprocess.run()` instead. – tripleee May 24 '21 at 15:41
  • @tripleee but when i run thr command i cited the code get stuck if manage to connect and don't move – Lucca Gontijo May 24 '21 at 15:54
  • If you don't read the pipe you set up it will get stuck because of that; but if you have no intention to read the pipe, just don't set up a pipe. – tripleee May 24 '21 at 15:56

0 Answers0