劣质-Shell 实时打印输出
Inferior-Shell Live Print Output
我正在使用 inferior-shell:run
来启动一个长期的 运行 任务,该任务通常会失败(这是一个构建验证例程)。
我的主要问题是我找不到查看已启动 activity 的 "live" 输出的方法。
我之所以喜欢直播,是因为如果发生错误,我看不到输出;我查看了 ON-ERROR:
键,但它只是说退出代码为 1。这是有道理的,因为看起来这个键是采取某种恢复操作的回调。但是,如果我的任务失败了,我也想知道它失败的原因,而且它隐藏在命令的输出中,似乎无法访问。
我试过这样调用 RUN
:
(inferior-shell:run
(pod-command file) ; this generates a string shell
; command from the arg FILE
:on-error #'print ; tells me that the exit code was 1
:output *standard-output* ; default, if I understand correctly
:interactive t) ; this was a shot in the dark
即使在成功的案例中,看到正在生成的输出(而不是在最后)仍然会很高兴,但这只是锦上添花。
我才刚刚开始学习 Lisp,所以如果我遗漏了一些明显的东西,我深表歉意。
我正在 inferior-shell
加载 quickload
sbcl
查看 inferior-shell:run
的文档字符串。您可以将 output
和 error-output
都设置为 :string
,这意味着它们将分别是第一个和第二个 return 值。第三个 return 值是退出代码。您可以使用 multiple-value-bind
绑定这些值。如果 :on-error
是 nil
,则在非零退出代码的情况下不会发出错误信号。
示例:
CL-USER> (inferior-shell:run "git status"
:on-error nil
:error-output :string
:output :string)
""
"fatal: Not a git repository (or any of the parent directories): .git
"
128
我正在使用 inferior-shell:run
来启动一个长期的 运行 任务,该任务通常会失败(这是一个构建验证例程)。
我的主要问题是我找不到查看已启动 activity 的 "live" 输出的方法。
我之所以喜欢直播,是因为如果发生错误,我看不到输出;我查看了 ON-ERROR:
键,但它只是说退出代码为 1。这是有道理的,因为看起来这个键是采取某种恢复操作的回调。但是,如果我的任务失败了,我也想知道它失败的原因,而且它隐藏在命令的输出中,似乎无法访问。
我试过这样调用 RUN
:
(inferior-shell:run
(pod-command file) ; this generates a string shell
; command from the arg FILE
:on-error #'print ; tells me that the exit code was 1
:output *standard-output* ; default, if I understand correctly
:interactive t) ; this was a shot in the dark
即使在成功的案例中,看到正在生成的输出(而不是在最后)仍然会很高兴,但这只是锦上添花。
我才刚刚开始学习 Lisp,所以如果我遗漏了一些明显的东西,我深表歉意。
我正在 inferior-shell
加载 quickload
sbcl
查看 inferior-shell:run
的文档字符串。您可以将 output
和 error-output
都设置为 :string
,这意味着它们将分别是第一个和第二个 return 值。第三个 return 值是退出代码。您可以使用 multiple-value-bind
绑定这些值。如果 :on-error
是 nil
,则在非零退出代码的情况下不会发出错误信号。
示例:
CL-USER> (inferior-shell:run "git status"
:on-error nil
:error-output :string
:output :string)
""
"fatal: Not a git repository (or any of the parent directories): .git
"
128