Index: src/bug_2664.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/bug_2664.py (revision 30d5620656aaa40b828945ea4a944c0a3fdc9fe6) +++ src/bug_2664.py (date 1523116619000) @@ -2,18 +2,18 @@ from time import gmtime, strftime # argv = "tnsping alias.fixer" -# argv = "/home/patrick/devjy /home/patrick/pycode/script2.py" -argv = "ping 192.168.0.9" +# Pinging Google 10 times +argv = ['ping', '8.8.8.8', '-c 10'] def system_call(argv, params=None, inshell=False, communicatestr='\n' * 10): cmds = argv try: - p = subprocess.Popen(args=cmds, executable='ping', bufsize=4096, + p = subprocess.Popen(args=cmds[:], executable=cmds[0], bufsize=4096, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) - stdoutdata, stderrdata = p.communicate() + stdoutdata, stderrdata = p.communicate(communicatestr) if stderrdata: print strftime("%Y-%m-%d %H:%M:%S", gmtime()) + ' - ' + stderrdata else: @@ -22,6 +22,6 @@ print strftime("%Y-%m-%d %H:%M:%S", gmtime()) + ' - ' + e.output pass - -while 1 == 1: - system_call(argv) \ No newline at end of file +# The while causes it to loop indefinitely +# while 1 == 1: +system_call(argv) \ No newline at end of file