tkf / emacs-ipython-notebook

IPython notebook client in Emacs
tkf.github.com/emacs-ipython-notebook/
GNU General Public License v3.0
548 stars 51 forks source link

Invalid arguments to ps in testein.py on OS X #119

Closed jhamrick closed 11 years ago

jhamrick commented 11 years ago

Running tools/testein.py fails on OS X, I think because it uses a different ps utility than that found in most linux distros. Here's the traceback I get:

Traceback (most recent call last):
  File "./tools/testein.py", line 501, in <module>
    main()
  File "./tools/testein.py", line 497, in main
    sys.exit(run_ein_test(**vars(args)))
  File "./tools/testein.py", line 428, in run_ein_test
    return 0
  File "./tools/testein.py", line 309, in __exit__
    self.stop()
  File "./tools/testein.py", line 352, in stop
    kill_subprocesses(self.proc.pid, lambda x: 'ipython' in x)
  File "./tools/testein.py", line 386, in kill_subprocesses
    '{2}'.format(command, proc.returncode, stderr))
RuntimeError: Command ['ps', '--ppid', '58047', '--format', 'pid,cmd', '--no-headers'] failed with code 1 and following error message:
ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-g grp[,grp...]] [-u [uid,uid...]]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]

It appears I have the BSD version of ps; the man page is dated March 20, 2005.

I am not sure if it is possible to change the ps call to be compatible with both linux and mac -- I'll look into it. If not, the script could just do a system check and call the command differently on different systems.

P.S. Thank you for this wonderful, wonderful emacs plugin!

tkf commented 11 years ago

Thanks for the report. I take a look at man page and it turns out that double dash option is GNU extension. So I guess single dash UNIX style or no dash BSD style would solve the problem http://linux.die.net/man/1/ps I prefer singe dash.

If you interested in changing it, you can just make it work and mac and send a pull request. You would see a result in Travis CI so you would know if it works on linux or not.

jhamrick commented 11 years ago

Whoops, ok, that doesn't seem to build in Travis CI:

Killing PID= COMMAND=3929 /home/travis/build/tkf/emacs-ipython-notebook/env/ipy.dev/bin/python env/ipy.dev/bin/ipython notebook --notebook-dir ./tests/notebook --debug --no-browser
Traceback (most recent call last):
  File "tools/testein.py", line 517, in <module>
    main()
  File "tools/testein.py", line 513, in main
    sys.exit(run_ein_test(**vars(args)))
  File "tools/testein.py", line 444, in run_ein_test
    return 0
  File "tools/testein.py", line 309, in __exit__
    self.stop()
  File "tools/testein.py", line 352, in stop
    kill_subprocesses(self.proc.pid, lambda x: 'ipython' in x)
  File "tools/testein.py", line 408, in kill_subprocesses
    os.kill(int(cmd_pid), signal.SIGINT)
ValueError: invalid literal for int() with base 10: ''

I'm not sure why it's parsing the pid incorrectly now, but I'll look into it and fix it.