[erlang-questions] how can I run emacs from erlang

Richard A. O'Keefe ok@REDACTED
Wed Jul 17 00:50:21 CEST 2013


I have a little C program called ttyname, whose source code is
	#include <stdio.h>
	#include <unistd.h>

	int main(void) {
	    char *s = ttyname(0);
	    return s == 0 || puts(s) == EOF;
	}

> os:cmd("emacs").
answers
"emacs: standard input is not a tty\n".

> os:cmd("emacs -nw </dev/tty >/dev/tty").
answers
"/bin/sh: line 1: /dev/tty: Device not configured\n"

So what I sometimes do is

% export TTYNAME=`ttyname`
% erl
...
> TTY = os:getenv("TTYNAME").
...
> os:cmd("emacs -nw <" ++ TTY ++ " >" ++ TTY).

and that works fine.





More information about the erlang-questions mailing list