Xcode 4: custom behavior does not execute my sh script?

走远了吗. 提交于 2020-01-11 10:24:29

问题


I created a custom behavior in Xcode 4 (Xcode > behaviors > edit behaviors > +) in order to launch a shell script (which is configured to be executable). I can invoke the behavior using the menu or my custom shortcut (console shows up as specified), but the script is not executed (no output in the console). The script has been already tested in the terminal and it works fine! and I also created a dummy script with a simple echo and the result is the same... why? How can I debug this?

EDIT:

After solving the problem I realized what I had in mind, if you are interested read my post: Generate beautiful code documentation with a simple shortcut using AppleDoc, Xcode custom behaviors and AppleScript!


回答1:


Your script probably is running, but the output of such scripts is not piped to the debugger console. The output should be visible in the Console application (/Applications/Utilities/Console) as in the following example:


As for debugging this kind of thing, you can add the following line at the top of your script to send all output to a log file:
exec &>/path/to/logfile

You could then add something like this at the end of your script to allow you to peruse the log:

open -a TextEdit /path/to/logfile


来源:https://stackoverflow.com/questions/8400756/xcode-4-custom-behavior-does-not-execute-my-sh-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!