testing codes in erl with running processes

HP Wei hp@REDACTED
Fri Apr 25 14:51:24 CEST 2003


>HP Wei writes:
> > I have an erl session, in which there is a process running.
> > 
> > I load a testing module which is unrelated to the running process;
> > then, 
> > I type fx(...), without specifying the module name: test:fx(...).
> > erl tells me so dutifully.
> > But after a few seconds, the running process also exits
> > with {badarg...} type of error.
> > 
> > Can the action of testing codes somehow
> > interfere with a process running in the background ??
>
>If a process is linked to the shell and the shell exits, then that
>process will receive an exit signal. An error in the shell causes the
>shell process to exit and restart:
>
>  1> self().
>  <0.25.0>
>  2> fx().
>  ** exited: {undef,[{shell_default,fx,[]},
>  3> self().
>  <0.40.0>
>
>If you don't want that behaviour, make sure your process isn't linked
>to the shell process, for instance by starting it via spawn() instead
>of spawn_link().

   I checked my code for that process at issue.  
   It uses spawn(Mod, loop, [Tab]). 
   In the loop(),
   there is a receive
                 stop -> stop
              after 30000 ->
                 loop(Tab)
              end.
              
   I use your simple test:
   self(). 
   and 
   fx().
   ---------> the shell exited as you described.   
              And after a few moment,
              that process also died !!
              
 Any idea whether there is bug somewhere ??
 
--HP




More information about the erlang-questions mailing list