diff options
| -rw-r--r-- | README.md | 17 | ||||
| -rwxr-xr-x | try | 22 |
2 files changed, 25 insertions, 14 deletions
@@ -70,20 +70,9 @@ This test works with python >= 3.5. ### Environement variables -My test only gives the `PATH=minishell_test/bin` and `TERM=xterm-256color` variables to your minishell. -**Please check that your project still work with those settings before messaging me on Slack or creating an issue**. - -You can test this quickly in a python script: - -```python -import subprocess -p = subprocess.run( - ["./minishell", "-c", "<INPUT>"], - capture_output=True, - env={"PATH": "minishell_test/bin", "TERM": "xterm-256color"} -) -print(p.stdout.decode()) -``` +My test only gives the `PATH=minishell_test/bin` and `TERM=xterm-256color` environment variables to your minishell. +**Please check that your project still work with those settings before messaging me on Slack or creating an issue**. +You can test this quickly with the [try](try) script (e.g `./try 'echo bonjour | cat -e'`). ## Bonus @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import os +import sys +import subprocess + +from src.config import MINISHELL_DIR, MINISHELL_EXEC, EXECUTABLES_PATH + + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("Usage {} command".format(sys.argv[0])) + sys.exit(1) + print("=================== RUNNING " + sys.argv[1]) + process = subprocess.Popen( + [os.path.join(MINISHELL_DIR, MINISHELL_EXEC), "-c", sys.argv[1]], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + env={"PATH": EXECUTABLES_PATH, "TERM": "xterm-256color"} + ) + out, _ = process.communicate() + print(out.decode()) |
