From 4a4a5d760698ccd6fa7ba331a115f89812789b42 Mon Sep 17 00:00:00 2001
From: Matt Wala <wala1@illinois.edu>
Date: Thu, 16 Feb 2017 12:54:48 -0600
Subject: [PATCH] Test knl.restart().

---
 pymbolic/interop/maxima.py | 3 +--
 test/test_maxima.py        | 9 +++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/pymbolic/interop/maxima.py b/pymbolic/interop/maxima.py
index 1486ff7..2dabf2b 100644
--- a/pymbolic/interop/maxima.py
+++ b/pymbolic/interop/maxima.py
@@ -345,8 +345,7 @@ class MaximaKernel:
     # {{{ execution control
 
     def restart(self):
-        from signal import SIGKILL
-        self.child.kill(SIGKILL)
+        self.child.close(force=True)
         self._initialize()
 
     def shutdown(self):
diff --git a/test/test_maxima.py b/test/test_maxima.py
index 7dcfa2e..7ddbb68 100644
--- a/test/test_maxima.py
+++ b/test/test_maxima.py
@@ -128,6 +128,15 @@ def test_long_command(knl):
     knl.eval_str("+".join(["1"]*16384))
 
 
+def test_restart(knl):
+    pytest.importorskip("pexpect")
+
+    knl = MaximaKernel()
+    knl.restart()
+    knl.eval_str("1")
+    knl.shutdown()
+
+
 if __name__ == "__main__":
     import sys
     if len(sys.argv) > 1:
-- 
GitLab