Newline in .erlang.cookie

Ian Zerny <[email protected]> Mon, 11 Sep 2006 16:09:43 +0200
Newsgroups gmane.comp.lang.erlang.distel.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have just found a small cause of irritation in distel. The error I
received was:

'''
error in process sentinel: if: Can't handle event closed in state
derl-recv-challenge-ack
error in process sentinel: Can't handle event closed in state
derl-recv-challenge-ack
'''

I found the error, it was my bad :)
Erlang and distel seem to handle the existence of a trailing newline in
the .erlang.cookie file differently. Erlang strips it and distel keeps
it intact. I made a small change to the derl.el to ignore the existence
of a single newline. The behavior seems to be consistent to that of the
erl interpreter.

Here is the change, hope it can help others.

derl.el
- ---------------------------
(defun erl-cookie ()
  (or derl-cookie
      (with-temp-buffer
	(insert-file-contents (concat (getenv "HOME")
                                      "/.erlang.cookie"))
>	(when (> (string-to-number (count-matches "\n")) 1)
>	  (error "Invalid erlang cookie file"))
>	(replace-match "")
	(buffer-string))))


Besides that, thank you very much for distel, it rocks!
Kind regards, Ian
- --
Ian Zerny
[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFBW4n2OwSIcfPeZcRAr3XAJ92WvF+UgUH+/T7yMQdIlBYsklziwCgqLvA
07EuQI1IoNFZZx4zBg5PWow=
=InJi
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642