Skip to content

Commit 839393c

Browse files
rashedmytPrabhakar Kumar
authored andcommitted
Add onCleanup function to restore the state of hotlinks feature.
1 parent 4b0a612 commit 839393c

File tree

1 file changed

+2
-4
lines changed
  • src/jupyter_matlab_kernel/matlab/+jupyter

1 file changed

+2
-4
lines changed

src/jupyter_matlab_kernel/matlab/+jupyter/execute.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@
4545

4646
% Disable Hotlinks in the output captured. The hotlinks do not have a purpose
4747
% in Jupyter notebooks.
48-
previousState = feature('hotlinks','off');
48+
hotlinksPreviousState = feature('hotlinks','off');
49+
hotlinksCleanupObj = onCleanup(@() feature('hotlinks', hotlinksPreviousState))
4950

5051
% Use the Live editor API for execution of MATLAB code and capturing the outputs
5152
resp = jsondecode(matlab.internal.editor.evaluateSynchronousRequest(request));
5253

53-
% Reset the hotlinks feature.
54-
feature('hotlinks',previousState);
55-
5654
% Post-process the outputs to conform to Jupyter API.
5755
result = processOutputs(resp.outputs);
5856

0 commit comments

Comments
 (0)