help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Encoding error when calling a ruby script from Emacs using shell-command


From: Marcelo de Moraes Serpa
Subject: Encoding error when calling a ruby script from Emacs using shell-command
Date: Thu, 30 Aug 2012 12:40:01 -0500

Hi list,

I have a small Ruby CLI program that I want to call from emacs. This script simply opens an emacs orgmode file from a specific location in my hard drive, and does some text processing. When I call it from the terminal directly, it works fine. When I call it from emacs, the script fails with an encoding error.

I'm using this elisp to call it from emacs after a buffer is saved:

(defun test ()
  (let ((universal-coding-system-argument 'us-ascii-mac))
        (shell-command  "/Users/myself/.rvm/bin/rvm ruby-1.9.3-p194 do /usr/bin/myrubyscript")
    ))
(add-hook 'after-save-hook 'test)

After I save a buffer, the shell-command function is fired, but I get the following output in the "*Shell Command Output*" buffer:

F, [2012-08-30T01:59:18.688827 #94004] FATAL -- : invalid byte sequence in US-ASCII (ArgumentError)
/Users/myself/.rvm/gems/ruby-1.9.3-p194/gems/org-ruby-0.6.3/lib/org-ruby/parser.rb:89:in `split'
/Users/myself/.rvm/gems/ruby-1.9.3-p194/gems/org-ruby-0.6.3/lib/org-ruby/parser.rb:89:in `initia

The strange thing is that the file that this script opens *is* accessible, and is the same file it would open if it were fired up from the terminal. For some reason, Emacs is getting in the way, but I have no idea what that could be. Am I missing something? If someone could enlighten me here, I'd be really grateful!

Thanks in advance,

- Marcelo.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]