Running Ruby interpreter in subshell (OS X)

Brian Marick <[email protected]> Wed, 5 Jun 2002 13:17:21 -0500
Newsgroups gmane.emacs.macintosh.user
Message-ID <p05111b05b924057f53bc@[63.57.3.28]>
I can't seem to run the Ruby interpreter as a subshell on OS X. (Ruby
is a language kind of like Python.)

Ruby comes with some .el files that define M-x run-ruby (and all the
usual sub-interpreter commands you'd expect). It works as expected
with the dumb-terminal version of emacs that comes with OS X. M-x
run-ruby doesn't work with the flashier emacs I downloaded (details
below). Other kinds of subshells work.

The symptom is that when I M-x run-ruby, I get an empty buffer, rather
than a prompt. The mode line shows state "run". If I type a character,
it switches to "exit". That happens even if I switch buffers without
typing anything to the process.

Clues?

-------------------
Specifics: This report is for the precompiled binary I got from
<http://www.cse.cuhk.edu.hk/~akochoi/emacs/21.1/emacs-21.1-mac-bin.smi.bin>
"GNU Emacs 21.1.30.3 (powerpc-apple-darwin5.2.2) of 2002-02-10 on
localhost"
I'm running OS X 10.1.4.
The version of Ruby is 1.6.4, precompiled, from
<http://www.apple.com/downloads/macosx/unix_apps_utilities/rubyprogramminglanguage.html>

As far as I can tell, the Ruby executable is a pretty standard
command-line program. It accepts lines from stdin, sends output to
stdout. Nothing funny.

Similar programs seem to work. By giving a numeric argument to
M-x run-ruby, I can get it to prompt for the command to run. Both tcsh and
ftp work fine (including when ftp prompts for a password).

(Note that this means there's a workaround: have run-ruby start tcsh,
then start the interpreter within it. That seems to work fine, but I
want to know what's going on.)

I think this problem is unrelated to the inf-ruby.el code that defines
M-x run-ruby, since a teensy elisp function has the same behavior:

(defun test-run (prog)
   (pop-to-buffer (make-comint "ruby" prog)))


The Ruby interpreter is not quite a true executable. Instead, it's a
Ruby script that invokes the Ruby executable. It looks like this:

#!/usr/bin/env ruby
... ruby code that checks command line args and calls one of two
initialization functions ...

So I tried a file called "shell-exec-ftp" that looks like this:
#!/usr/bin/env ftp

That works. It differs from irb in that it has nothing after the #!
line, but I can't think of anything on this fresh system that I could
make look like how (I think) irb actually works.)


-- 
--
If this mail message is supposed to have an attachment, doesn't seem 
to, and you use Outlook to read mail: you've probably been bitten by 
an Outlook bug. The attachment is really there, Outlook just isn't 
showing it to you. You can still save it with File | Save 
Attachments. (If that doesn't work, I must have forgotten to attach 
the file.) I'm sorry my choice of a Macintosh and the Eudora mailer 
is an inconvenience to you.


"Act always so as to increase the number of choices." -- Heinz von Foerster

--
Brian Marick, [email protected]
www.testing.com - Software testing services and resources
www.testingcraft.com - Where software testers exchange techniques
www.visibleworkings.com - Adequate understanding of system internals

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm