执行具有管理员权限的shell命令时,AppleScript的应用程序挂在10.9 [英] Applescript application hangs on 10.9 when executing a shell command with administrator privileges

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

问题描述

我执行以下线的AppleScript应用程序。

 设置POSIX_path为/Applications/iPhoto.app
做shell脚本命令RM -rfv&放大器; POSIX_path的引号形式具有管理员权限

鉴别屏幕上弹出,因为它应该,但认证申请只是冻结在执行此命令后。仅发生在10.9这个问题。

当我设置文件夹的权限要删除对人人可以阅读和放大器;写。它的工作原理

有没有人有什么线索已​​经改变?

编辑:当我通过检查重复这个脚本的执行杜-shx /Applications/iMovie.app <​​/ code>它管理删除一些文件,更与每一个尝试<。 / p>

  $开放compiled-applescript.app/
$杜-shx /Applications/iMovie.app
1.4G /Applications/iMovie.app
- 强制退出AppleScript的 -
$开放compiled-applescript.app/
$杜-shx /Applications/iMovie.app
1.3G /Applications/iMovie.app
- 强制退出AppleScript的 -
$开放compiled-applescript.app/
$杜-shx /Applications/iMovie.app
1.0G /Applications/iMovie.app


解决方案

在乱投医理清这个问题,我终于发现是什么原因导致这个问题天。

这是详细选项(-v)的RM-命令。离开它使应用程序的工作又无措。
也许苹果推出了意外的缓冲区溢出。我将在这个问题ID 15309626我在苹果的错误追踪系统创建报告这一情况。也许他们会解决它,直到第10.10 DP:D

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

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?

EDIT: 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.

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆