Changeset 14449 for misc/runpugs

Show
Ignore:
Timestamp:
10/22/06 01:37:16 (2 years ago)
Author:
andara
Message:

[runpugs]
-new UI with more terminal-like behaviour ("runpugs2")
-plumbing to support non-interactive scripts

Location:
misc/runpugs
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • misc/runpugs/bin/termdispatcher2.pl

    r14430 r14449  
    1818print "Sending msg $id: $cmd\n"; 
    1919my $ip="127.0.0.1"; 
    20 (my $reply,my $histref) = &Web::Terminal::Dispatcher::send($id,$ip,$prompt.$cmd); 
     20(my $reply,my $prompt,my $histref) = &Web::Terminal::Dispatcher::send($id,$ip,$prompt.$cmd); 
    2121print $reply; 
    2222print "\nHistory\n"; 
  • misc/runpugs/cgi-bin/runpugs2

    r14430 r14449  
    3030if ($MAX_SIZE_UPLOAD) { $CGI::POST_MAX=1024 * $MAX_SIZE_UPLOAD; } 
    3131use CGI::Carp qw(fatalsToBrowser); 
     32use HTML::Entities; 
    3233 
    3334CGI::nph();   # Treat script as a non-parsed-header script 
     
    6162#$ip='127.'.int(rand(100)).'.'.int(rand(100)).'.'.int(rand(100)); 
    6263#} 
     64    my $prompt=$Web::Terminal::Settings::prompt; 
    6365######### MAIN SITEMANAGER PROGRAM ################### 
    6466 
    6567if ( $query->param()) {      # an action has been chosen 
    66     my $cmd=$query->param("cmd"); 
     68    my $cmd=$query->param("cmdline"); 
    6769    my $action =  $query->param("action")||'runpugs'; 
    6870    if ($action =~ /^(\w+)$/) { 
     
    9496    my $sessionid=shift; 
    9597    my $ip=shift; 
    96 #    my $reply='pugs> '; 
     98#    my $prompt=$Web::Terminal::Settings::prompt; 
     99    my $nprompt=$query->param('prompt')||$prompt; 
     100    my $preply=''; 
     101    if($query->param('output')) { 
     102        $preply=$query->param('output'); 
     103    } 
    97104    my $reply=$Web::Terminal::Settings::prompt; 
    98105    my @history=(); 
     106    my $prevcmd=''; 
    99107    my $testing=$query->param('testing')||1; 
    100108    if (not $testing) { 
    101     $reply = "Sorry, runpugs is not available at the moment."; 
     109        $reply = "Sorry, runpugs is not available at the moment."; 
    102110    } else { 
    103 #    $cmd=~s/^.+?pugs([\>\.])/pugs$1/s; 
    104     if(not $query->param('history') or ($query->param('history') eq '')) { 
    105     $cmd=~s/^.+?${Web::Terminal::Settings::prompt_pattern}/$1/s; 
    106     } else { 
    107     $cmd=$Web::Terminal::Settings::prompt; 
    108     $cmd.=$query->param('history'); 
    109     } 
    110     #NO UNICODE! 
    111 #    $cmd=tr/\0-\x{10ffff}/\0-\xff_/; 
    112     if ($cmd=~/clear/) { 
    113         $cmd=''; 
    114     } elsif ($cmd!~/^\p{IsASCII}*$/) { 
    115         $cmd=''; 
    116         $reply = "Sorry, Unicode is not yet 
    117         supported.\n".$Web::Terminal::Settings::prompt; 
    118     } else { 
    119     if ($cmd=~/>\s+(\:*help)\b/) { 
    120         $cmd=~s/$1/:h/; 
    121     } elsif ($cmd=~/>\s+(\:*(quit|bye))\b/) { 
    122         $cmd=~s/$1/:q/; 
    123     }  
    124     ($reply, my $histref) = &Web::Terminal::Dispatcher::send($sessionid,$ip,$cmd); 
    125     @history=@{$histref}; 
    126     $reply="\n".$reply; 
    127     } 
    128     } 
    129     #$reply.="\n$ip\n$sessionid\n"; 
    130     my $historylist='<select name="history" id="hist">'."\n".'<option value="">--- Recent commands ---</option>'."\n"; 
     111        if(not $query->param('history') or ($query->param('history') eq '')) { 
     112#            $cmd=~s/^.+?${Web::Terminal::Settings::prompt_pattern}/$1/s; 
     113        } else { 
     114#            $cmd=$Web::Terminal::Settings::prompt; 
     115#            $cmd.=$query->param('history'); 
     116            $cmd=$query->param('history'); 
     117        } 
     118        if ($cmd=~/clear/) { 
     119            $cmd=''; 
     120            $preply=''; 
     121        } elsif ($cmd!~/^\p{IsASCII}*$/) { #NO UNICODE! 
     122            $cmd=''; 
     123            $reply = "Sorry, Unicode is not yet supported.\n".$Web::Terminal::Settings::prompt; 
     124        } else { 
     125            if ($cmd=~/>\s+(\:*help)\b/) { 
     126                $cmd=~s/$1/:h/; 
     127            } elsif ($cmd=~/>\s+(\:*(quit|bye))\b/) { 
     128                $cmd=~s/$1/:q/; 
     129            }  
     130            ($reply, $nprompt, my $histref) = &Web::Terminal::Dispatcher::send($sessionid,$ip,$cmd); 
     131            if (defined $histref) { 
     132                @history=@{$histref}; 
     133                $prevcmd=$history[-1]; 
     134            } 
     135            #$cmd=$prompt.$history[-1]; 
     136            $prompt=$nprompt; 
     137            #$reply="\n".$reply.$prompt; 
     138        } 
     139    } 
     140#    my $promptw=HTML::Entities::encode_entities($prompt); 
     141    my $npromptw=HTML::Entities::encode_entities($nprompt); 
     142#    my $prevcmdw=HTML::Entities::encode_entities($prevcmd); 
     143#    my $preplyw=HTML::Entities::encode_entities($preply); 
     144     
     145    #my $replyw=HTML::Entities::encode_entities("$preplyw\n$promptw$prevcmdw\n$reply"); 
     146    my $replyw="$preply$prompt$prevcmd\n$reply"; 
     147#            $prompt=$nprompt; 
     148    if($preply eq '' and $cmd eq '') { 
     149        $replyw=''; 
     150    } 
     151   my $nrows=scalar split("\n",$replyw);  
     152#    $nrows++; 
     153     ($replyw=~/^\s*$/) && ($nrows=1); 
     154    if ($nrows>20) {$nrows=20;} 
     155    my $historylist="\n"; 
    131156    for my $entry (@history) { 
    132     $entry=~s/\>/\&gt\;/g; 
    133     $historylist.='<option value="'.$entry.'">'.$entry.'</option>'."\n"; 
    134     } 
    135     $historylist.='</select>'."\n"; 
     157        $entry=~s/\>/\&gt\;/g; 
     158        $historylist.='<option value="'.$entry.'">'.$entry.'</option>'."\n"; 
     159    } 
    136160    my $html=''; 
    137161    open(HTML,"<../data/runpugs2.html"); 
    138162    while(<HTML>) { 
    139     /_HIST_/ && do { 
    140     $html.=$historylist; 
    141     next; 
    142     }; 
    143     s/_TESTING_/$testing/; 
    144         /input.*name=\"sessionid\"/ && do {$html.='<input type="hidden" name="sessionid" value="'.$sessionid.'">'."\n";next }; 
    145         /(pugs\&gt\;\&nbsp\;)/ && do {$html.=$cmd.$reply;next}; 
    146  
    147         /([^\`\\]+$)/ && do {$html.=$1}; 
    148  
    149       } 
     163        /_HIST_/ && do { 
     164            $html.=$historylist; 
     165            next; 
     166        }; 
     167        s/_TESTING_/$testing/; 
     168        /input.*name=\"sessionid\"/ && do { 
     169            $html.='<input type="hidden" name="sessionid" value="'.$sessionid.'">'."\n"; 
     170            next;  
     171            }; 
     172        s/_PROMPTW_/$npromptw/; 
     173=not_now         
     174        /_PREPLYW_/ && do { 
     175#            $html.=$preplyw; 
     176            next; 
     177        }; 
     178        /_CMDW_/ && do { 
     179#            chomp $html; 
     180#            $html.=$prevcmdw."\n\n"; 
     181            next; 
     182        }; 
     183        /_BSKIP_/ && do { 
     184#        ($replyw=~/^\s*$/) && ($html.='<!--'); 
     185        next; 
     186        }; 
     187        /_ESKIP_/ && do { 
     188#        ($replyw=~/^\s*$/) && ($html.='-->'); 
     189        next; 
     190        }; 
     191=cut 
     192        /_REPLYW_/ && do { 
     193            chomp $html; 
     194            $html.=$replyw; 
     195            next; 
     196        }; 
     197        /_NPROMPTW_/ && do { 
     198            chomp $html; 
     199            $html.=$npromptw; 
     200            next; 
     201        }; 
     202        s/_NROWS_/$nrows/; 
     203        /([^\`\\]+$)/ && do {$html.=$1}; 
     204    } 
    150205        close HTML; 
    151206        &printhttpheader(); 
  • misc/runpugs/data/runpugs2.html

    r14430 r14449  
    2222return true; 
    2323} 
     24 
     25function select_enter() 
     26{ 
     27document.terminal.cmdline.value=document.terminal.hist.options[document.terminal.hist.selectedIndex].value; 
     28document.terminal.hist.selectedIndex=0; 
     29document.terminal.cmdline.focus(); 
     30} 
     31 
     32function select_enter_OFF(myfield,e) 
     33{ 
     34var keycode; 
     35if (window.event) keycode = window.event.keyCode; 
     36else if (e) keycode = e.which; 
     37else return true; 
     38if (keycode == 13) 
     39{ 
     40//document.terminal.submit(); 
     41document.terminal.cmdline.value=document.terminal.hist.options[document.terminal.hist.selectedIndex].value; 
     42return false; 
     43} 
     44else 
     45return true; 
     46} 
    2447</script> 
    2548</head> 
     
    3255href="http://feather.perl6.nl/~andara/runpugs/">info page</a>. 
    3356</p> 
    34 <form style="text-align: center" id="term" name="terminal" 
     57<form style="text-align: left" id="term" name="terminal" 
    3558action="/cgi-bin/runpugs2" method="POST">                   
    3659                                
    3760<input type="hidden" name="testing" value="_TESTING_"> 
     61<input type="hidden" name="prompt" value="_PROMPTW_"> 
    3862<input type="hidden" name="sessionid" value=""> 
    3963<input type="hidden"    name="action" value="runpugs"> 
    40 <!--<textarea id="history" name="history"  rows="1" cols="1" 
    41 style="overflow: hidden; border: 0px; width: 0px; 
    42 font-size:0px">_CMD_</textarea>--> 
    43 <label for="cmd">Interactive Pugs Session<br> 
     64<!--<label for="cmd">Interactive Pugs Session<br>--> 
     65<h2>Interactive Pugs Session</h2> 
     66<div id="termwindow"> 
     67<select name="history" id="hist" onChange="select_enter()"><!--onKeyPress="return 
     68select_enter(this,event)">--> 
     69<option value="">--- Recent commands ---</option> 
    4470_HIST_ 
    45 <textarea id="cmd" name="cmd" rows="24" cols="80" wrap="virtual" onKeyPress="return submitenter(this,event)"> 
    46 pugs&gt;&nbsp; 
     71</select> 
     72<br> 
     73<!-- 
     74<span class="prompt"> 
     75_PROMPTW_ 
     76</span> 
     77<span class="termfont"> 
     78_CMDW_ 
     79</span> 
     80<br> 
     81--> 
     82<textarea readonly id="output" name="output" rows="_NROWS_" cols="80" wrap="virtual"> 
     83_REPLYW_ 
    4784</textarea> 
     85<br> 
     86<label for="cmdline"><span class="prompt"> 
     87_NPROMPTW_ 
     88</span> 
     89<input type="text" size="74" id="cmdline" name="cmdline" value="" 
     90onKeyPress="return submitenter(this,event)"> 
    4891</label> 
     92</div> 
    4993<br> 
    5094<input id="enter" type="submit" value="Submit">&nbsp;&nbsp;&nbsp; 
     
    5296<script language="JavaScript"> 
    5397document.terminal.enter.style.display='none'; 
    54 document.terminal.cmd.focus() 
     98document.terminal.cmdline.focus() 
     99document.terminal.output.scrollTop =document.terminal.output.scrollHeight; 
     100if (document.terminal.output.rows==1) { 
     101//document.terminal.output.style.height="2ex"; 
     102} 
    55103</script> 
    56104<p class="copyright">&copy; Copyright 2006 by Wim Vanderbauwhede</p> 
  • misc/runpugs/htdocs/index.html

    r14374 r14449  
    1515href="http://feather.perl6.nl:8080/cgi-bin/runpugs">here</a>.</p> 
    1616<p><em>Instructions:</em> <tt>runpugs</tt> presents the pugs interactive shell. Only 
    17 the line typed at the last prompt is sent to pugs. Type <code>:h</code> for 
    18 help, <code>:q</code> to quit. <br><em>Please</em> be considerate and do close your 
    19 pugs session with <code>:q</code> before you close the browser window.<br>Type <code>clear</code> to clear the web terminal (this command is not sent to pugs).</p> 
     17the line typed at the last prompt is sent to pugs. Type <code>:h</code> or 
     18<code>help</code> for 
     19help, <code>:q</code> (or <code>quit</code> or <code>bye</code>) to quit. 
     20<br><em>Please</em> be considerate and do <em>quit</em> your 
     21pugs session  before you close the browser window.<br>Type <code>clear</code> to clear the web terminal (this command is not sent to pugs).</p> 
    2022<p>Because this is a web terminal, a number of restrictions apply:</p> 
    2123 
     
    2931<p>The current values relating to the above restrictions are:</p> 
    3032<ul> 
    31 <li>Total number of sessions: 50</li> 
     33<li>Maximum number of lines of output: 250</li> 
    3234<li>Inactivity time-out: 10 minutes</li> 
    3335<li>"Long" call time-out: 10 seconds</li> 
     36<li>Total number of sessions: 50</li> 
    3437<li>Sessions per IP: 10</li> 
    3538<li>Available memory: 64M.</li> 
     
    4144<li>There is no command history.</li> 
    4245</ul> 
    43 <p>You can find the source code for <tt>runpugs</tt> (in Perl 5) in the <a href="http://svn.openfoundry.org/pugs/">pugs subversion repository</a> under <code>/misc/runpugs</code>. 
     46<p>You can find the source code for <tt>runpugs</tt> (in Perl 5) in the <a 
     47href="http://svn.openfoundry.org/pugs/">pugs subversion repository</a> under 
     48<code><a href="http://svn.openfoundry.org/pugs/misc/runpugs">/misc/runpugs</a></code>. 
    4449<p>Thank you for trying <tt>pugs</tt> and <tt>runpugs</tt>!</p> 
    4550<p class="copyright">&copy; Copyright 2006 by Wim Vanderbauwhede</p> 
  • misc/runpugs/htdocs/runpugs.css

    r14430 r14449  
    1515} 
    1616#mainwindow { 
    17 width: 750px  
     17width: 85ex; /*750px */ 
    1818} 
    1919#hist { 
    20 width: 750px; 
    21 border: solid 2px #204a87; 
     20 width: 100%; /*750px; */ 
    2221font-family: "Andale Mono", courier, fixed, monospace; 
     22font-weight: normal; 
    2323font-size: 10pt; 
    24 color: #204a87; 
     24 color: #204a87; 
     25border: solid 0px #204a87; 
    2526    background-color: #f2f2f0; 
    2627    padding-bottom: 5px; 
     28} 
     29#termwindow { 
     30    height: 45ex; /*400px;*/ 
     31    background-color: #f2f2f0; 
     32        border: solid 2px #204a87; 
     33    padding: 5px; 
     34} 
     35.prompt { 
     36    font-family: "Andale Mono", courier, fixed, monospace; 
     37    font-size: 11pt; 
     38font-weight: bold; 
     39    line-height: 12pt; 
     40    color: #204a87; 
     41    background-color: #f2f2f0; 
     42/*        border: solid 0px #f2f2f0;*/ 
     43} 
     44.termfont { 
     45    font-family: "Andale Mono", courier, fixed, monospace; 
     46    font-size: 11pt; 
     47font-weight: normal; 
     48    line-height: 12pt; 
     49    color: #204a87; 
     50    background-color: #f2f2f0; 
     51/*        border: solid 0px #f2f2f0;*/ 
     52} 
     53#cmdline { 
     54width: 90%; /* sadly, Safari would need 92% */ 
     55    font-family: "Andale Mono", courier, fixed, monospace; 
     56    font-size: 11pt; 
     57    font-weight: normal; 
     58    line-height: 12pt; 
     59    color: #204a87; 
     60    background-color: #f2f2f0; 
     61        border: solid 0px #f2f2f0; 
     62} 
     63#output { 
     64width: 100%; 
     65    font-family: "Andale Mono", courier, fixed, monospace; 
     66    font-size: 11pt; 
     67    font-weight: normal; 
     68    line-height: 12pt; 
     69    color: #204a87; 
     70    background-color: #f2f2f0; 
     71        border: solid 0px #f2f2f0; 
     72        /* for IE */ 
     73        overflow: visible; 
    2774} 
    2875#cmd { 
    2976    font-family: "Andale Mono", courier, fixed, monospace; 
    3077    font-size: 11pt; 
     78    font-weight: normal; 
    3179    line-height: 12pt; 
    3280    color: #204a87; 
  • misc/runpugs/lib/Web/Terminal/Dispatcher.pm

    r14430 r14449  
    2727        my $host = $Web::Terminal::Settings::host; 
    2828        my $port = $Web::Terminal::Settings::port; 
    29         my $cmd=''; 
     29        my $cmd=$cmds;#''; 
     30=old     
    3031    # we only consider the last line with a prompt 
    3132        my @cmdlines=split("\n",$cmds); 
     
    4142                }; 
    4243        }  
     44=cut 
     45     
    4346#   We're using PUGS_SAFEMODE=1 instead  
    4447#    if ($Web::Terminal::Settings::filter and 
     
    7174      my $reply=$rmesgref->{msg}; 
    7275      my $histref=$rmesgref->{recent}; 
     76      my $prompt=$rmesgref->{prompt}; 
    7377    $conn->disconnect(); 
    7478        if ( "$id" ne  "$rid" ) { 
     
    7680        return "Sorry, the pugs session died."; 
    7781        } 
    78         return ($reply,$histref); 
     82        return ($reply,$prompt,$histref); 
    7983   } 
    8084} 
  • misc/runpugs/lib/Web/Terminal/Server.pm

    r14430 r14449  
    4646    $terminals{$id}->{called}=time; 
    4747                my $term  = $terminals{$id}; 
    48         push  @{$term->{recent}},$cmd; 
     48        push  @{$term->{recent}},$cmd unless $cmd=~/^\s*$/; 
    4949        if (scalar @{$term->{recent}}> $Web::Terminal::Settings::nrecent) { 
    5050            shift @{$term->{recent}}; 
     
    5959            } 
    6060            $sessions_per_ip{$ip}--; 
     61            return $lines; 
    6162#               } 
    6263        #if ($lines=~/Aborted/s) { 
     
    7172                return $lines; 
    7273        } else { 
    73             return "pugs> "; 
     74            return $Web::Terminal::Settings::prompt; 
    7475        } 
    7576        } else { 
     
    8485            $terminals{$id}->{ip}=$ip; 
    8586                my $term = $terminals{$id}; 
    86             my $init= $term->{'init'}; 
     87            my $init= $term->{'output'}; 
    8788            my $error= $term->{'error'}; 
    8889            if ($error==1) { # Failed to create a new terminal 
     
    115116            print LOG2 scalar(localtime)," : $nsess : $ip : $id : $pid > ",$cmd,"\n"; 
    116117                        my $lines = &termhandler( $id, $ip, $cmd ); 
    117             my @history=('--- Recent commands ---'); 
     118            my @history=(''); #   --- Recent commands ---'); 
     119            my $prompt=$Web::Terminal::Settings::prompt; 
     120            if (exists $terminals{$id}){  
     121                $prompt=$terminals{$id}->{prompt}; 
    118122            if (defined $terminals{$id}->{recent}) { 
    119123             @history=@{$terminals{$id}->{recent}}; 
    120124            } 
     125            } 
    121126            my 
    122             $replyref=YAML::Syck::Dump({id=>$id,msg=>$lines,recent=>\@history}); 
     127            $replyref=YAML::Syck::Dump({id=>$id,msg=>$lines,recent=>\@history,prompt=>$prompt}); 
    123128                        $conn->send_now($replyref); 
    124129 
  • misc/runpugs/lib/Web/Terminal/Server/Session.pm

    r14430 r14449  
    1919        my $class    = ref($invocant) || $invocant; 
    2020        my $self     = {@_}; 
    21 #       my $prompt = '/\>\ /'; 
    22     my $prompt= '/'.$Web::Terminal::Settings::init_pattern.'/'; 
     21        #my $prompt = '/\>\ /'; 
     22    my $prompt ='/'.$Web::Terminal::Settings::prompt.'/'; 
     23    $self->{'prompt'}=$prompt; 
     24   # my $prompt= '/'.$Web::Terminal::Settings::init_pattern.'/'; 
     25    #my $prompt= '/'.$Web::Terminal::Settings::prompt_pattern.'/'; 
    2326    $self->{'error'}=0; 
    2427    $self->{'recent'}=[]; 
     
    2831    &spawn($Web::Terminal::Settings::command);    # spawn() defined below 
    2932    if ( $self->{'pty'}==-1 and  $self->{'pid'}==0) { 
    30         $self->{'init'}= "\nThere was a problem starting pugs. Please try again later."; 
     33        $self->{'output'}= "\nThere was a problem starting pugs. Please try again later."; 
    3134        $self->{'error'}=1; 
    3235    } else { 
     
    4043                -cmd_remove_mode => 0, 
    4144        ); 
    42         #( $self->{'init'}, my $m ) = $self->{'pugs'}->waitfor( 
    4345    my $error=''; 
    44     ( my $p, my $m ) = $self->{'pugs'}->waitfor( 
    45                 -match   => $self->{'pugs'}->prompt, 
    46                 -errmode => "return" 
    47           ) or do { 
    48           $self->{'error'}=1; 
    49           $error="\nThere was a problem starting pugs. Please try again later."; 
    50           # should close the TTY 
    51           $self->{'pugs'}->close(); 
    52       }; 
     46#    ( my $p, my $m ) = $self->{'pugs'}->waitfor( 
     47#               -match   => $self->{'pugs'}->prompt, 
     48#               -errmode => "return" 
     49#         ) or do { 
     50#          $self->{'error'}=1; 
     51#          $error="\nThere was a problem starting pugs. Please try again later."; 
     52#          # should close the TTY 
     53#          $self->{'pugs'}->close(); 
     54#      }; 
     55        bless($self,$class); 
     56    my $m=$self->readlines(); 
    5357      #die "starting pugs failed: ", $self->{'pugs'}->lastline; 
    54         $self->{'init'}= $p.$m.$error;#$self->{'pugs'}->prompt; 
    55     } 
    56         bless($self,$class); 
     58        $self->{'output'}= $m; #$p.$m.$error;#$self->{'pugs'}->prompt; 
     59    } 
     60        #bless($self,$class); 
    5761        return $self; 
    5862} 
     63 
     64sub readlines { 
     65        my $obj = shift; 
     66        my $ps = ''; 
     67 
     68        my $i     = 1; 
     69        my $lline = ''; 
     70    my $pugs=$obj->{'pugs'}; 
     71    $pugs->errmode(sub {kill 9,$obj->{'pid'};}); 
     72 
     73        while ($i<$Web::Terminal::Settings::nlines) { 
     74    my $char=''; 
     75    my $line=''; 
     76    while ($char ne "\n") { 
     77    $char=$pugs->get; 
     78    $line.=$char; 
     79    last if $line eq $Web::Terminal::Settings::prompt; 
     80    } 
     81#               my $line = $pugs->getline; 
     82#        chomp $line; 
     83        print $line; 
     84        my $msg=$pugs->errmsg; 
     85            if($msg=~/timed/) { 
     86            $msg=''; 
     87            $pugs->errmsg([]); 
     88            $lline="${Web::Terminal::Settings::prompt} Sorry, that took too long! Aborted.\n"; 
     89            $pugs->close(); 
     90            $ps=$Web::Terminal::Settings::prompt; 
     91            $obj->{'error'}=1; 
     92            last; 
     93        } 
     94        $msg=''; 
     95        if ( ($line =~ /$Web::Terminal::Settings::prompt_pattern/ or 
     96        ($line=~/$Web::Terminal::Settings::quit_pattern/)) and $i > 1 ) { $ps = $1; last } 
     97                $lline .= $line unless $line =~ 
     98        /$Web::Terminal::Settings::prompt_pattern/; 
     99                $i++; 
     100        } 
     101 
     102   if ($i>=$Web::Terminal::Settings::nlines-1) { 
     103       $obj->{pugs}->close(); 
     104        kill 9, $obj->{'pid'}; 
     105        $lline.="Generated output is limited to $Web::Terminal::Settings::nlines lines. Aborted.\npugs"; 
     106        $obj->{'error'}=1; 
     107    } 
     108    chomp $ps; # a hack! 
     109        #$lline .= $ps; 
     110        $obj->{prompt}=$ps; 
     111        return $lline; 
     112} # end readlines method 
    59113 
    60114sub write { 
     
    109163 
    110164    chomp $ps; # a hack! 
    111         $lline .= $ps; 
     165#       $lline .= $ps; 
     166        $obj->{prompt}=$ps; 
    112167        return $lline; 
    113168}    # end write method 
  • misc/runpugs/lib/Web/Terminal/Settings.pm

    r14430 r14449  
    3535); 
    3636 
     37=ghci 
     38#GHCi 
    3739our $command='/usr/local/bin/ghci'; 
    3840our $prompt='Prelude> '; 
     
    4042our $quit_pattern='^Leaving\ GHCi\.'; 
    4143our $quit_message='Leaving GHCi.'; 
     44=cut 
    4245 
     46#Pugs 
     47our $command='/usr/bin/nice /usr/bin/pugs'; 
     48our $prompt='pugs> '; 
     49our $prompt_pattern='(^(pugs|\.\.\.\.)>\s+)'; 
     50our $quit_pattern='^Leaving\ pugs\.'; 
     51our $quit_message='Leaving pugs.'; 
    4352 
    44 #our $command='/usr/bin/nice /usr/bin/pugs'; 
     53our $init_pattern='(\>\s+)'; 
     54our $quit_command=':q'; 
    4555our $server='termserv2.pl'; 
    46 #our $prompt='pugs> '; 
    47 our $init_pattern='(\>\s+)'; 
    48 #our $prompt_pattern='(^(pugs|\.\.\.\.)>\s+)'; 
    49 our $quit_command=':q'; 
    50 #our $quit_pattern='^Leaving\ pugs\.'; 
    51 #our $quit_message='Leaving pugs.'; 
    5256 
    5357our $filter=0;