diff --git a/__pycache__/main.cpython-311.pyc b/__pycache__/main.cpython-311.pyc index 6d4a8c5..093220e 100644 Binary files a/__pycache__/main.cpython-311.pyc and b/__pycache__/main.cpython-311.pyc differ diff --git a/main.py b/main.py index ba03897..4f7e43e 100644 --- a/main.py +++ b/main.py @@ -71,6 +71,8 @@ async def update_post(id: int, post: Post): my_posts[index] = post_dict return {"data": post_dict} + + @app.get("/list") async def ping_host(): # send one packet of data to the host @@ -78,7 +80,8 @@ async def ping_host(): outputlist = [] # Iterate over all the servers in the list and ping each server # get the output as a string - # output = str(os.system(cmd)) - output = subprocess.run(["/bin/ls", "-l"],stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + #output = str(os.system(cmd)) + cmd = subprocess.run(["/bin/ls", "-al"],stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True) # store the output in the list - output2 = (f"{output.stdout}") \ No newline at end of file + output = (f"{cmd.stdout}") + return output \ No newline at end of file