Squirrel / Squirrel.Mac

:shipit: Cocoa framework for updating OS X apps :shipit:
MIT License
1.59k stars 128 forks source link

fix SMJobSubmit fail on some osx #197

Closed sunuslee closed 7 years ago

sunuslee commented 7 years ago

SMJobSubmit will fail on some osx(tested in 10.11). when this happened, the job will be shown in the launchctl list but will never be executed (ShipIt not running) and the process will be terminated by later [NSApp terminate:self] as expected. so we manually launchctl start the ShipIt job.

Signed-off-by: sunuslee sunuslee@gmail.com

joshaber commented 7 years ago

I'm pretty conservative about making changes to Squirrel.Mac, given:

  1. The original maintainers are gone.
  2. A lot of projects depend on it.

So to consider this PR, I'll need a more thorough description of the bug and how this is addressing it.

sunuslee commented 7 years ago

@joshaber when this bug happened , if the user finished downloading the new update file, the app will quit and won't launch again. because it's ShipIt's responsibility to bring up the app, but ShipIt can not start running in the first place, because SMJobSumit failed.

joshaber commented 7 years ago

but ShipIt can not start running in the first place, because SMJobSumit failed

But why does it fail?

sunuslee commented 7 years ago

@joshaber i wish i knew the answer. but it seems like an apple's bug to me. when you run launchctl submit -l test -p /usr/bin/touch -- /usr/bin/touch /var/tmp/test it should be a file in /var/tmp/test and it will show you this job

$ launchctl list test

{
    "LimitLoadToSessionType" = "Aqua";
    "Label" = "test";
    "TimeOut" = 30;
    "OnDemand" = false;
    "LastExitStatus" = 0;
    "Program" = "/usr/bin/touch";
    "ProgramArguments" = (
        "/usr/bin/touch";
        "/var/tmp/test";
    );
};

but when this bug happened, this simple command will only show you the job in launchctl list , and not executing at all. i wish i knew what's going on inside the system:(

sunuslee commented 7 years ago

@joshaber can you offer a better solution?

joshaber commented 7 years ago

I can't since I don't fully understand the bug or how it happens. But I'm hesitant to fix an apparent race condition by introducing another potential race condition.

joshaber commented 7 years ago

Closing due to inactivity.