Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
906 stars 99 forks source link

Irony-server executes command but emacs displays nothing. #299

Open bclaudel opened 8 years ago

bclaudel commented 8 years ago

Hi,

I am a happy user of the irony-mode on Mac OS X, but I did not succeed to make it work on my Linux.

I am using emacs-24.5.1, clang-3.8.0 and irony-mode from MELPA (20160317.1527). Emacs seems able to start the irony-server, send it commands but unable to receive the answers (or to parse the log file).

Starting emacs in this simple example:

class Base {
  void foo() {};
}

int main()
{
  Base b;
  b.

  return 0;
}

starts the irony-server:

ps aux | grep irony

beclaude 20583  2.0  0.0 112108  2760 ?        Ss   15:48   0:00 /bin/csh -c /home/beclaude/.emacs.d/irony/bin/irony-server -i 2> /tmp/irony.2016-04-09_15h-48m-52s.log
beclaude 20716  0.0  0.0 127060 10412 ?        S    15:48   0:00 /home/beclaude/.emacs.d/irony/bin/irony-server -i 2

Trying to complete b. (L8) gives the following log (server side):

cat /tmp/irony.2016-04-09_15h-48m-52s.log
(
("Base" 75 "" "" "Base::" 4 ("::"))
("operator=" 34 "Base &" "" "operator=(const Base &)" 9 ("(const Base &)" 1 13))
("~Base" 34 "void" "" "~Base()" 5 ("()"))
)

;;EOT

which seems ok. But emacs displays anything.

Displaying the content of the variable irony-completion--candidates right after gives nothing:

irony-completion--candidates is a variable defined in `irony-completion.el'.
Its value is nil

Thanks for your help.

bclaudel commented 8 years ago

I noticed in the command line: /bin/csh -c /home/beclaude/.emacs.d/irony/bin/irony-server -i 2> ...

Hence, this bug is due to the inconsistency of stderr redirection between tcsh and bash.

Using bash instead of tcsh everything works fine.

Sarcasm commented 8 years ago

that's right I think someone got a similar issue once on FreeBSD

emacs18 commented 7 years ago

My work-around for this is the following. Perhaps shell-file-name should be set (relying on dynamic binding) within irony code.

(defun my--advice-irony-start-process (orig-func &rest args)
  (let ((shell-file-name "/bin/sh"))
    (apply orig-func args)))

(advice-add 'irony--start-server-process :around 'my--advice-irony-start-process)