mirror of
https://github.com/XaverKlemenschits/jupyter-c-kernel.git
synced 2025-04-16 03:16:22 +00:00
Dockerized project :)
This commit is contained in:
parent
8ad18c3d91
commit
177229a39d
8
Dockerfile
Normal file
8
Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM jupyter/minimal-notebook
|
||||
MAINTAINER Brendan Rius <ping@brendan-rius.com>
|
||||
|
||||
USER root
|
||||
|
||||
COPY ./ /home/$NB_USER/.jupyter/jupyter_c_kernel/
|
||||
RUN pip install /home/$NB_USER/.jupyter/jupyter_c_kernel/
|
||||
RUN jupyter-kernelspec install /home/$NB_USER/.jupyter/jupyter_c_kernel/
|
@ -28,6 +28,7 @@ class CKernel(Kernel):
|
||||
"""Create a new temp file to be deleted when the kernel shuts down"""
|
||||
# We don't want the file to be deleted when closed, but only when the kernel stops
|
||||
kwargs['delete'] = False
|
||||
kwargs['mode'] = 'w'
|
||||
file = tempfile.NamedTemporaryFile(**kwargs)
|
||||
self.files.append(file.name)
|
||||
return file
|
||||
@ -37,7 +38,7 @@ class CKernel(Kernel):
|
||||
"""Execute a command and returns the return code, stdout and stderr"""
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
return p.returncode, stdout, stderr
|
||||
return p.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')
|
||||
|
||||
@staticmethod
|
||||
def compile_with_gcc(source_filename, binary_filename):
|
||||
|
@ -7,5 +7,5 @@
|
||||
"{connection_file}"
|
||||
],
|
||||
"display_name": "C",
|
||||
"language":"c"
|
||||
}
|
||||
"language": "c"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user