<div dir="ltr">This is a patch for user_drv.erl which allows the user to specify which shell/program to start when starting a new job, both local and remote. The patch includes a modified help text. It is completely backwards compatible.<br>
<br>It has been tested in LFE with no problems.<br><br>Robert<br><br>--<br>*** user_drv.erl.orig Tue Jun 10 21:16:10 2008<br>--- user_drv.erl Thu Apr 24 04:17:35 2008<br>***************<br>*** 335,340 ****<br>--- 335,344 ----<br>
switch_cmd({ok,[{atom,_,j}],_}, Iport, Oport, Gr) -><br> io_requests(gr_list(Gr), Iport, Oport),<br> switch_loop(Iport, Oport, Gr);<br>+ switch_cmd({ok,[{atom,_,s},{atom,_,Shell}],_}, Iport, Oport, Gr0) -><br>
+ Pid = group:start(self(), {Shell,start,[]}),<br>+ Gr = gr_add_cur(Gr0, Pid, {Shell,start,[]}),<br>+ switch_loop(Iport, Oport, Gr);<br> switch_cmd({ok,[{atom,_,s}],_}, Iport, Oport, Gr0) -><br> Pid = group:start(self(), {shell,start,[]}),<br>
Gr = gr_add_cur(Gr0, Pid, {shell,start,[]}),<br>***************<br>*** 354,359 ****<br>--- 358,368 ----<br> Pid = group:start(self(), {Node,shell,start,[]}),<br> Gr = gr_add_cur(Gr0, Pid, {Node,shell,start,[]}),<br>
switch_loop(Iport, Oport, Gr);<br>+ switch_cmd({ok,[{atom,_,r},{atom,_,Node},{atom,_,Shell}],_},<br>+ Iport, Oport, Gr0) -><br>+ Pid = group:start(self(), {Node,Shell,start,[]}),<br>+ Gr = gr_add_cur(Gr0, Pid, {Node,Shell,start,[]}),<br>
+ switch_loop(Iport, Oport, Gr);<br> switch_cmd({ok,[{atom,_,q}],_}, Iport, Oport, Gr) -><br> case erlang:system_info(break_ignored) of<br> true -> % noop<br>***************<br>*** 386,401 ****<br>
true -> <br> [];<br> false -><br>! [{put_chars," q - quit erlang\n"}]<br> end,<br>! io_requests([{put_chars," c [nn] - connect to job\n"},<br>
! {put_chars," i [nn] - interrupt job\n"},<br>! {put_chars," k [nn] - kill job\n"},<br>! {put_chars," j - list all jobs\n"},<br>! {put_chars," s - start local shell\n"},<br>
! {put_chars," r [node] - start remote shell\n"}] ++<br> QuitReq ++<br>! [{put_chars," ? | h - this message\n"}], Iport, Oport).<br> <br> get_line({done,Line,_Rest,Rs}, Iport, Oport) -><br>
io_requests(Rs, Iport, Oport),<br>--- 395,411 ----<br> true -> <br> [];<br> false -><br>! [{put_chars," q - quit erlang\n"}]<br> end,<br>
! io_requests([{put_chars," c [nn] - connect to job\n"},<br>! {put_chars," i [nn] - interrupt job\n"},<br>! {put_chars," k [nn] - kill job\n"},<br>
! {put_chars," j - list all jobs\n"},<br>! {put_chars," s [shell] - start local shell\n"},<br>! {put_chars," r [node [shell]] - start remote shell\n"}] ++<br>
QuitReq ++<br>! [{put_chars," ? | h - this message\n"}],<br>! Iport, Oport).<br> <br> get_line({done,Line,_Rest,Rs}, Iport, Oport) -><br> io_requests(Rs, Iport, Oport),<br>
<br></div>