以管理员权限执行

以管理员权限执行

本文介绍了以管理员权限执行 shell 命令时,Applescript 应用程序在 10.9 上挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Applescript 应用程序中执行以下行.

I'm executing the following line in an Applescript application.

set POSIX_path to "/Applications/iPhoto.app"
do shell script "sudo rm -rfv " & quoted form of POSIX_path with administrator privileges

验证屏幕会按原样弹出,但在验证应用程序后,在执行此命令时会冻结.此问题仅在 10.9 中出现.

The authentification screen pops up as it should but after authenticating the application just freezes upon executing this command. This problems only occurs in 10.9.

当我将要删除的文件夹的权限设置为每个人都可以读写"时,它就可以工作了.

When I set the permissions of the folder to be delete to "everyone can read & write" it works.

有没有人知道发生了什么变化?

Does anyone have a clue what has been changed?

当我通过检查 du -shx/Applications/iMovie.app 重复执行此脚本时,每次尝试都会设法删除更多文件.

When I repeat the execution of this script by checking du -shx /Applications/iMovie.app it manages to delete a few more files with every try.

$ open compiled-applescript.app/
$ du -shx /Applications/iMovie.app
1.4G    /Applications/iMovie.app
-- force quit AppleScript --
$ open compiled-applescript.app/
$ du -shx /Applications/iMovie.app
1.3G    /Applications/iMovie.app
-- force quit AppleScript --
$ open compiled-applescript.app/
$ du -shx /Applications/iMovie.app
1.0G    /Applications/iMovie.app

推荐答案

经过几天的尝试以解决此问题,我终于找到了导致此问题的原因.

After days of trying everything to sort out this problem I finally found what was causing this issue.

这是 rm 命令的详细选项 (-v).忽略它会使应用程序再次完美运行.也许苹果不小心引入了缓冲区溢出.我将在我在 Apple 的 bugtracker 上创建的问题 ID 15309626 下报告此问题.也许他们会在第一个 10.10 DP 之前修复它:D

It's the verbose-option (-v) of the rm-command. Leaving it out makes the application work flawless again.Maybe Apple accidently introduced a buffer overflow. I will report this under the problem ID 15309626 I created at Apple's bugtracker. Maybe they'll fix it until the first 10.10 DP :D

这篇关于以管理员权限执行 shell 命令时,Applescript 应用程序在 10.9 上挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 21:44