Ticket #213: 213_busy_shell.001.patch

File 213_busy_shell.001.patch, 1.0 KB (added by slavazanko, 15 years ago)
  • src/subshell.c

    diff --git a/src/subshell.c b/src/subshell.c
    index 8d98da5..2e135a2 100644
    a b feed_subshell (int how, int fail_on_error) 
    887887 
    888888    struct timeval wtime;       /* Maximum time we wait for the subshell */ 
    889889    struct timeval *wptr; 
     890    char lastChar;              /* for remove stupid 'The shell is already running a command' */ 
    890891 
    891892    /* we wait up to 10 seconds if fail_on_error, forever otherwise */ 
    892893    wtime.tv_sec = 10; 
    feed_subshell (int how, int fail_on_error) 
    984985            for (i = 0; i < bytes; ++i) 
    985986                if (pty_buffer[i] == subshell_switch_key) { 
    986987                    write_all (subshell_pty, pty_buffer, i); 
    987                     if (subshell_ready) 
     988                    if (subshell_ready) { 
    988989                        subshell_state = INACTIVE; 
     990                    } else { 
     991                        if (lastChar != 0xd ){ 
     992                            subshell_ready = TRUE; 
     993                            subshell_state = INACTIVE; 
     994                        } 
     995                    } 
    989996                    return TRUE; 
    990997                } 
    991998 
    992999            write_all (subshell_pty, pty_buffer, bytes); 
     1000            lastChar = (char) pty_buffer[bytes-1]; 
    9931001            subshell_ready = FALSE; 
    9941002        } else { 
    9951003            return FALSE;