Pass input contents to subprocess

I’m making a shell and I want to switch from os.system() to However, upon entering more than one word it tracebacks and exits. Any solutions?

This is too vague to help with. What does “entering more than one word”
actually mean, precisely? Can you provide a transcript of a terminal
session showing the failure? And a transcript of the exception you
mention above? And some source code we could use to demo the problem.

Not screenshots, cut/paste of the text please.

As it stands, your code might do anything, so it is impossible to
comment meaningfully.

Cameron Simpson

List of args:

>>>['ls', '-l'], capture_output=True)
CompletedProcess(args=['ls', '-l'], returncode=0, stdout=b'total 2032\ndrwxr-xr-x@ /.../