[plt-scheme] Interactions of the REPL and the shell

From: Dave Herman (dherman at ccs.neu.edu)
Date: Tue Jun 6 14:14:14 EDT 2006

Well, in the case of nohup, you don't want a stdin, right? It seems like 
an optional extra parameter or separate version of the `instaweb' 
function that tells it run in "background mode" would be appropriate, i.e.:

(instaweb filename port ip background?)
     : string [integer] [(U string #f)] [boolean] -> void

- filename: The file name of the servlet
- port: The optional port to listen on, defaults to 80
- ip: The optional IP address to listen on, or #f (the default)
for all addresses
- background?: If true, run silently in background mode, otherwise allow 
user input to control server (the default)

As a separate point, would it make sense (I don't know if it's possible) 
to run the servlet with the `current-directory' parameter set to the 
directory where the `instaweb' call came from, as opposed to the 
directory where the file is silently copied to? On the one hand, it 
would enable the common case of running a new little script that you 
didn't feel like building the whole `default-web-root' directory 
structure for. On the other hand, down the road when the user starts 
filling out the directory and treating the copied location as the "real 
servlet," it might get in the way. I guess an annoying side effect of 
copying a file.

All of this makes me wonder about the web-server -- perhaps a better 
solution would be for the web-server itself to allow a lighter-weight 
mechanism for creating servlets, without having to construct big 
directory structures.


Noel Welsh wrote:
> I have a problem with the interaction between the REPL,
> MzScheme flags, and the shell.
> I have a program (instaweb) that runs the web server and
> then reads a user command to restart or stop the server. 
> This is useful for development.  It is useful to use this
> same, tested, program to run the web server on the live
> server.  In this case we obviously don't want an
> interactive shell, as logging out would kill the web
> server.  So if the command to run the program is
>   mzscheme -qf run-server.ss
> we could instead run it as 
>   nohup mzscheme -qf run-server.ss &
> This is fine, except MzScheme now has no stdin.  The call
> to read in instaweb causes an error.  This error is caught
> by the repl, which prints an error message and loops.  In a
> few days it is possible to fill a 70GB disk with a log file
> containing just this error message.
> There are various hacks to fix this, and I've implemented
> one (in this case, a flag to instaweb determining if it
> reads).  I'm interested in the best way to solve this
> problem.  Ideally I don't want to have to remember special
> flags or bash commands to start the program to get it to
> work.  Instaweb would see that there is no stdin and so
> realise the interactive terminal isn't useful.  However the
> repl never returns the exception that indicates this.  I
> could change the error escape handler.  This is unorthodox
> (at least I haven't seen any examples of this before).  As
> it is I'm a bit lost between all the switches MzScheme
> takes, and the various interactions of the REPL.  Guidance
> appreciated.
> Thanks,
> Noel
> Email: noelwelsh <at> yahoo <dot> com   noel <at> untyped <dot> com
> AIM: noelhwelsh
> Blogs: http://monospaced.blogspot.com/  http://www.untyped.com/untyping/
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.