を使用してプロセスを生成しPopen
、特定の文字列をその に送信しようとしていますstdin
。
私は持っている:
pipe = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE)
pipe.communicate( my_stdin_str.encode(encoding='ascii') )
pipe.stdin.close()
ただし、実際には 2 行目で空白をエスケープしていますmy_stdin_str
。たとえば、私が持っている場合:
my_stdin_str="This is a string"
プロセスは次のように表示されます。
This\ is\ a\ string
どうすればこの動作を防ぐことができますか?