diff --git a/README.md b/README.md index 4c9e57a..47912c6 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ Works only on Linux and OS X. Windows is not supported yet. If you want to use t ```bash git clone https://github.com/XaverKlemenschits/jupyter-c-kernel.git cd jupyter-c-kernel -pip install -e . -cd jupyter_c_kernel && install_c_kernel --user +pip install -e . # for system install: sudo install . +cd jupyter_c_kernel && install_c_kernel --user # for sys install: sudo install_c_kernel # now you can start the notebook jupyter notebook ``` diff --git a/jupyter_c_kernel/kernel.py b/jupyter_c_kernel/kernel.py index 6194234..acdc0c7 100644 --- a/jupyter_c_kernel/kernel.py +++ b/jupyter_c_kernel/kernel.py @@ -61,6 +61,10 @@ class RealTimeSubprocess(subprocess.Popen): size -= 1 return res + stderr_contents = read_all_from_queue(self._stderr_queue) + if stderr_contents: + self._write_to_stderr(stderr_contents.decode()) + stdout_contents = read_all_from_queue(self._stdout_queue) if stdout_contents: contents = stdout_contents.decode() @@ -80,10 +84,6 @@ class RealTimeSubprocess(subprocess.Popen): else: self._write_to_stdout(contents) - stderr_contents = read_all_from_queue(self._stderr_queue) - if stderr_contents: - self._write_to_stderr(stderr_contents.decode()) - class CKernel(Kernel): implementation = 'jupyter_c_kernel' @@ -152,6 +152,7 @@ class CKernel(Kernel): def compile_with_gcc(self, source_filename, binary_filename, cflags=None, ldflags=None): # cflags = ['-std=c89', '-pedantic', '-fPIC', '-shared', '-rdynamic'] + cflags + # cflags = ['-std=c99', '-Wdeclaration-after-statement', '-Wvla', '-fPIC', '-shared', '-rdynamic'] + cflags # cflags = ['-std=iso9899:199409', '-pedantic', '-fPIC', '-shared', '-rdynamic'] + cflags # cflags = ['-std=c99', '-pedantic', '-fPIC', '-shared', '-rdynamic'] + cflags cflags = ['-std=c11', '-pedantic', '-fPIC', '-shared', '-rdynamic'] + cflags diff --git a/jupyter_c_kernel/resources/stdio_wrap.h b/jupyter_c_kernel/resources/stdio_wrap.h index e079947..62d5fa7 100644 --- a/jupyter_c_kernel/resources/stdio_wrap.h +++ b/jupyter_c_kernel/resources/stdio_wrap.h @@ -60,7 +60,7 @@ char checkInputRequest() { /* Need to define vscanf for c89. TODO: This is a bit risky, since the underlying glibc does not have to include this if it is old. If it does not, linking will fail. - The only safe way is reimplementing the whole function. */ + The better way would be readin via sscanf. */ /* Read formatted input from stdin into argument list ARG.