Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

今天使用测试了您的模块程序 #13

Open
mayaren888 opened this issue Mar 7, 2022 · 0 comments
Open

今天使用测试了您的模块程序 #13

mayaren888 opened this issue Mar 7, 2022 · 0 comments

Comments

@mayaren888
Copy link

mayaren888 commented Mar 7, 2022

import subprocess as sp

Print the return code (status=0 mean ping success)

status = sp.call(['tcping', '-c', '1', '-t', '1', 'github.com'], stdout=sp.DEVNULL, stderr=sp.DEVNULL)
print(status)

OR print the full message

status = sp.run(['tcping', '-c', '1', '-t', '1', 'github.com'], stdout=sp.DEVNULL, stderr=sp.DEVNULL)
print(status)

上面这段代码我在测试的时候发现,不管github.com 这个位置填写的 ip地址还是域名是否能连通,它返回的都会返回0,按您上面描述0等于可以ping通。不知道是为什么。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant