-
Notifications
You must be signed in to change notification settings - Fork 489
Description
I noticed the following unexpected behavior using poetry (which uses pexpect internally) in fish. Here is a minimal example using only pexpect:
# file test.py
import pexpect
child = pexpect.spawn("fish") # replace with "bash" to see different behavior
child.sendline("echo hello")
child.interact()
child.close()
Running the above results in the following terminal output (| represents the cursor position):
$ python test.py
$ echo hello|
Replacing "fish" with "bash" instead results in (I only press return after typing the first line):
$ python test.py
echo hello
$ echo hello
hello
$|
Apart from the duplicate echo hello command in the second output, the difference is that with bash the command sent via sendline is immediately executed, while with fish the command is just appended to the command line of the spawned shell.
With a single command, this is mildly inconvenient. However, if I use multiple sendline calls, bash executes them correctly in succession, while fish appends them together forming an invalid command!