[erlang-patches] Patch for user_drv.erl

Robert Virding rvirding@REDACTED
Tue Aug 26 17:28:34 CEST 2008


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.

It has been tested in LFE with no problems.

Robert

--
*** user_drv.erl.orig    Tue Jun 10 21:16:10 2008
--- user_drv.erl    Thu Apr 24 04:17:35 2008
***************
*** 335,340 ****
--- 335,344 ----
  switch_cmd({ok,[{atom,_,j}],_}, Iport, Oport, Gr) ->
      io_requests(gr_list(Gr), Iport, Oport),
      switch_loop(Iport, Oport, Gr);
+ switch_cmd({ok,[{atom,_,s},{atom,_,Shell}],_}, Iport, Oport, Gr0) ->
+     Pid = group:start(self(), {Shell,start,[]}),
+     Gr = gr_add_cur(Gr0, Pid, {Shell,start,[]}),
+     switch_loop(Iport, Oport, Gr);
  switch_cmd({ok,[{atom,_,s}],_}, Iport, Oport, Gr0) ->
      Pid = group:start(self(), {shell,start,[]}),
      Gr = gr_add_cur(Gr0, Pid, {shell,start,[]}),
***************
*** 354,359 ****
--- 358,368 ----
      Pid = group:start(self(), {Node,shell,start,[]}),
      Gr = gr_add_cur(Gr0, Pid, {Node,shell,start,[]}),
      switch_loop(Iport, Oport, Gr);
+ switch_cmd({ok,[{atom,_,r},{atom,_,Node},{atom,_,Shell}],_},
+        Iport, Oport, Gr0) ->
+     Pid = group:start(self(), {Node,Shell,start,[]}),
+     Gr = gr_add_cur(Gr0, Pid, {Node,Shell,start,[]}),
+     switch_loop(Iport, Oport, Gr);
  switch_cmd({ok,[{atom,_,q}],_}, Iport, Oport, Gr) ->
      case erlang:system_info(break_ignored) of
      true ->                    % noop
***************
*** 386,401 ****
            true ->
                [];
            false ->
!               [{put_chars,"  q        - quit erlang\n"}]
            end,
!     io_requests([{put_chars,"  c [nn]   - connect to job\n"},
!          {put_chars,"  i [nn]   - interrupt job\n"},
!          {put_chars,"  k [nn]   - kill job\n"},
!          {put_chars,"  j        - list all jobs\n"},
!          {put_chars,"  s        - start local shell\n"},
!          {put_chars,"  r [node] - start remote shell\n"}] ++
           QuitReq ++
!          [{put_chars,"  ? | h    - this message\n"}], Iport, Oport).

  get_line({done,Line,_Rest,Rs}, Iport, Oport) ->
      io_requests(Rs, Iport, Oport),
--- 395,411 ----
            true ->
                [];
            false ->
!               [{put_chars,"  q                 - quit erlang\n"}]
            end,
!     io_requests([{put_chars,"  c [nn]            - connect to job\n"},
!          {put_chars,"  i [nn]            - interrupt job\n"},
!          {put_chars,"  k [nn]            - kill job\n"},
!          {put_chars,"  j                 - list all jobs\n"},
!          {put_chars,"  s [shell]         - start local shell\n"},
!          {put_chars,"  r [node [shell]]  - start remote shell\n"}] ++
           QuitReq ++
!          [{put_chars,"  ? | h             - this message\n"}],
!         Iport, Oport).

  get_line({done,Line,_Rest,Rs}, Iport, Oport) ->
      io_requests(Rs, Iport, Oport),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20080826/a6323e93/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff
Type: application/octet-stream
Size: 2531 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20080826/a6323e93/attachment.obj>


More information about the erlang-patches mailing list