AppleScript Objective-C忽略了“退出”关键字

时间:2016-03-09 20:03:11

标签: objective-c applescript exit applescript-objc

在我的代码中,我正在运行使用quit关键字的多个函数。出于某种原因,当编译并运行代码时,似乎忽略了quit。我可以使用它的唯一方法是使用两个quit。有什么想法吗?

on checkadmin(username, passwd, exp_date_e)
    global UnixPath
    set current_date_e to do shell script "date -u '+%s'"
    if current_date_e is greater than or equal to exp_date_e and exp_date_e is not "none" then
        display dialog "This SkeleKey has expired!" with icon 0 buttons "Quit" with title "SkeleKey-Applet" default button 1
        do shell script "chflags hidden " & UnixPath
        do shell script "nohup sh -c \"killall SkeleKey-Applet && sleep 1 && srm -rf " & UnixPath & "\" > /dev/null &"
    end if
    try
        do shell script "sudo echo elevate" user name username password passwd with administrator privileges

        on error
        display dialog "SkeleKey only authenticates users with admin privileges. Maybe the wrong password was entered?" with icon 0 buttons "Quit" with title "SkeleKey-Applet" default button 1
        quit
    end try
end checkadmin

main()函数调用此函数并传递适当的变量。

1 个答案:

答案 0 :(得分:0)

>java -jar org.eclipse.jdt.core_3.11.1.v20150902-1521.jar -8 Test2.java Test.java >javap -p Test Compiled from "Test.java" public class Test { public Test(); public static void main(java.lang.String[]); private static java.util.stream.Stream lambda$0(java.util.List); private static boolean lambda$1(java.util.Map, java.lang.Object); private static void lambda$2(java.lang.Object); } 不会导致进程立即终止。它只告诉它的主事件循环停止运行,以便在当前代码完成执行后进程将退出并将控制权返回给事件循环。如果你想在quit命令之后跳过所有内容,请提出一个适当的错误号,然后你可以在顶级处理程序的末尾捕获它:

quit