diff --git a/src/subshell.c b/src/subshell.c
index 8d98da5..2e135a2 100644
a
|
b
|
feed_subshell (int how, int fail_on_error) |
887 | 887 | |
888 | 888 | struct timeval wtime; /* Maximum time we wait for the subshell */ |
889 | 889 | struct timeval *wptr; |
| 890 | char lastChar; /* for remove stupid 'The shell is already running a command' */ |
890 | 891 | |
891 | 892 | /* we wait up to 10 seconds if fail_on_error, forever otherwise */ |
892 | 893 | wtime.tv_sec = 10; |
… |
… |
feed_subshell (int how, int fail_on_error) |
984 | 985 | for (i = 0; i < bytes; ++i) |
985 | 986 | if (pty_buffer[i] == subshell_switch_key) { |
986 | 987 | write_all (subshell_pty, pty_buffer, i); |
987 | | if (subshell_ready) |
| 988 | if (subshell_ready) { |
988 | 989 | subshell_state = INACTIVE; |
| 990 | } else { |
| 991 | if (lastChar != 0xd ){ |
| 992 | subshell_ready = TRUE; |
| 993 | subshell_state = INACTIVE; |
| 994 | } |
| 995 | } |
989 | 996 | return TRUE; |
990 | 997 | } |
991 | 998 | |
992 | 999 | write_all (subshell_pty, pty_buffer, bytes); |
| 1000 | lastChar = (char) pty_buffer[bytes-1]; |
993 | 1001 | subshell_ready = FALSE; |
994 | 1002 | } else { |
995 | 1003 | return FALSE; |