想在 git 的 pre-commit hook 里面执行一段命令,目前想新建一个窗口去执行和输出,同时还想在执行完毕后拿到 exit code 做为 pre-commit 的 exit code ,现在的问题是我貌似拿不到这个新窗口执行的 exit code 。有什么办法么?
新建窗口使用的是在 pre-commit 的 shell 环境调用 Apple Scirpt: to do script with command "shell commmand" 但是没找到这个 shell commnad 的 exit code 如何获取回到 pre-commit 的环境中再 exit 这个 code 。 google 了好多,仍然没有找到答案 T.T 有别的思路和方法也可以提 一下,感谢
主要代码如下
r=$(osascript<<EOF
tell application "Terminal"
activate
set t to do script with command "cd $pwd; set -o pipefail && xcodebuild -workspace $workspace -scheme $scheme -sdk $sdk -destination $destination test | xcpretty"
tell front window
set position to {150, 150}
set size to {1100, 700}
end tell
repeat
delay 1
if not busy of t then exit repeat
end repeat
display notification "switching to terminal..." with title "Unit Test Finished" sound name "Glass"
activate
end tell
EOF)