From afa692c669e03c510b3d5d6a8b17f9ca18af4da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 17 Jan 2023 13:25:56 +0100 Subject: [PATCH] OS Commands --- README.md | 2 +- index.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b1ae931..da23e4b 100644 --- a/README.md +++ b/README.md @@ -1731,7 +1731,7 @@ shutil.rmtree() # Deletes the directory. ```python = os.popen('') # Executes command in sh/cmd. Returns its stdout pipe. = .read(size=-1) # Reads 'size' chars or until EOF. Also readline/s(). - = .close() # Closes the pipe. Returns None on success. + = .close() # Closes the pipe. Returns None on success (returncode 0). ``` #### Sends '1 + 1' to the basic calculator and captures its output: diff --git a/index.html b/index.html index 31c9587..9ceb918 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -1455,7 +1455,7 @@ shutil.rmtree(<path>) # Deletes t

Shell Commands

<pipe> = os.popen('<command>')      # Executes command in sh/cmd. Returns its stdout pipe.
 <str>  = <pipe>.read(size=-1)       # Reads 'size' chars or until EOF. Also readline/s().
-<int>  = <pipe>.close()             # Closes the pipe. Returns None on success.
+<int>  = <pipe>.close()             # Closes the pipe. Returns None on success (returncode 0).
 

Sends '1 + 1' to the basic calculator and captures its output:

>>> subprocess.run('bc', input='1 + 1\n', capture_output=True, text=True)
@@ -2920,7 +2920,7 @@ $ pyinstaller script.py --add-data '<path>:.'