.App捆绑包中的外壳脚本出现

发布于 2025-01-19 21:58:12 字数 2098 浏览 0 评论 0原文

我使用名为 myApp.command 的shell脚本来打开一个应用程序,例如Microsoft PowerShell应用程序:

#!/bin/sh
exec /usr/local/microsoft/powershell/7/pwsh

脚本正常。但是,当我将相同的脚本放入MacOS捆绑包中(称为MyApp.App)时,它不起作用。我收到的错误消息是, myApp.app出人意料地退出

错误报告显示,该错误发生在/applications/myapp.app/contents/macos/myapp.command中。

异常类型:exc_crash(sigabrt)

异常注意:exc_corpse_notify

程序特定信息:abort()称为

info of Info.plist.plist。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleGetInfoString</key>
    <string>1.0, Copyright © 2019 MyCompany, All Rights Reserved</string>
    <key>CFBundleIdentifier</key>
    <string>com.mycompany.MyApp</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>mycompany.myapp</string>
    <key>CFBundlePackageType</key>
    <string>BNDL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>NSHumanReadableCopyright</key>
    <string>Copyright © 2019 MyCompany, All Rights Reserved.</string>
    <key>NSPrincipalClass</key>
    <string>ShellScript</string>
    <key>CFBundleExecutable</key>
    <string>myapp.command</string>
    <key>CFBundleIconFile</key>
    <string>MyCompany</string>
    <key>NSMainNibFile</key>
    <string>main.nib</string>
</dict>
</plist>

应用

I use a shell script named myapp.command to open an app such as the Microsoft PowerShell app:

#!/bin/sh
exec /usr/local/microsoft/powershell/7/pwsh

The script works fine. However, when I put the same script inside a macOS bundle (called myapp.app), it does not work. The error message I get is, myapp.app quit unexpectedly.

Error report reveals that the error occurs in /Applications/myapp.app/Contents/MacOS/myapp.command.

Exception type: EXC_CRASH (SIGABRT)

Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information: abort() called

The contents of Info.plist are as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleGetInfoString</key>
    <string>1.0, Copyright © 2019 MyCompany, All Rights Reserved</string>
    <key>CFBundleIdentifier</key>
    <string>com.mycompany.MyApp</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>mycompany.myapp</string>
    <key>CFBundlePackageType</key>
    <string>BNDL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>NSHumanReadableCopyright</key>
    <string>Copyright © 2019 MyCompany, All Rights Reserved.</string>
    <key>NSPrincipalClass</key>
    <string>ShellScript</string>
    <key>CFBundleExecutable</key>
    <string>myapp.command</string>
    <key>CFBundleIconFile</key>
    <string>MyCompany</string>
    <key>NSMainNibFile</key>
    <string>main.nib</string>
</dict>
</plist>

How can I fix/troubleshoot this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

西瓜 2025-01-26 21:58:12

pwsh崩溃,因为它未连接到任何

工作的TTY,就是告诉终端应用程序启动它:

#!/bin/sh
osascript -e '
    tell app "Terminal"
        do script "/usr/local/microsoft/powershell/7/pwsh; exit $?"
        activate
    end tell
'

pwsh crashes because it is not connected to any tty

A work-around is to tell the Terminal App to launch it:

#!/bin/sh
osascript -e '
    tell app "Terminal"
        do script "/usr/local/microsoft/powershell/7/pwsh; exit $?"
        activate
    end tell
'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文