镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ipykernel/zmqshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import typing
import warnings
from pathlib import Path
from subprocess import CalledProcessError

from IPython.core import page
from IPython.core.autocall import ZMQExitAutocall
Expand Down Expand Up @@ -783,9 +784,14 @@ def system_piped(self, cmd):
with AvoidUNCPath() as path:
if path is not None:
cmd = f"pushd {path} &&{cmd}"
self.user_ns["_exit_code"] = system(cmd)
exit_code = system(cmd)
self.user_ns["_exit_code"] = exit_code
else:
self.user_ns["_exit_code"] = system(self.var_expand(cmd, depth=1))
exit_code = system(self.var_expand(cmd, depth=1))
self.user_ns["_exit_code"] = exit_code

if getattr(self, "system_raise_on_error", False) and exit_code != 0:
raise CalledProcessError(exit_code, cmd)

# Ensure new system_piped implementation is used
system = system_piped
Expand Down