Final report and recommendation:
1. If shell-True, subprocess will execute /bin/bash. Code works if an executable shell script and arguments are provided.
2. it is better to pass arguments in as a list. Example: cmd=['ping', '126.96.36.199;, '-c 10']. If you do this, you do not need to specify an executable= setting.
3. p.communicate() closes the stdin, stdout, stderr streams,
collects all input for output. Inserting 10 newlines (\n) has no
effect. It is appropriate to leave it empty, or use None.
4. The only way text can be inserted into the stdin is if the external program has a function to do the following: sys.stdout.write(sys.stdin.read(). This can be done internally with Jython and Python code.
I've attached the updated tnsping.py scrpt. My previous patches were poorly thought out and will not work. My apologies.
Recommendation: Mark this issue as invalid as the code works with
no errors with the minor changes that were made.
Patrick Palczewski <email@example.com> added the comment: Yes, I saw in the documentation after I posted. It was pretty late. :/