Re: [PATCH v3 3/4] maintenance: use launchctl on macOS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 13, 2020 at 3:42 PM Derrick Stolee <stolee@xxxxxxxxx> wrote:
> On 11/13/2020 3:19 PM, Eric Sunshine wrote:
> >     if (pipe_command(child, NULL, 0, &out, 0, &err, 0) {
> >         if (out.len && err.len)
> >             strbuf_addstr(&out, "; ");
> >         strbuf_addbuf(&out, &err);
> >         die(_("launchctl failed: %s"), out.buf);
> >     }
>
> We would also want to pass a "die_on_failure" into the method, since
> in the 'git maintenance start' case we don't want to report a failure
> when 'launchctl bootout' fails before we call 'launchctl bootstrap'.

Right. I started writing that we'd also need a `die_one_failure` flag
but deleted the comment since I decided to wait until I got an
answer...

> > By the way, won't this die() be a problem when schedule_plist() calls
> > boot_plist() to remove the old scheduled tasks before calling it again
> > to register the new ones? If the old ones don't exist, then it will
> > die() unnecessarily and never register the new ones. Or am I
> > misunderstanding? (I'm guessing that I must be misunderstanding since
> > the test script presumably passes.)
>
> This die() is only if the process cannot _start_, for example due to
> launchctl not existing on $PATH. The result from finish_command()
> would be non-zero when we bootout a plist that doesn't exist.

... to this question.

Another thought I had was simply checking for the presence of the file
and skipping `bootout` altogether if it doesn't exist. That would, I
think, obviate the need for mucking with stdout/stderr oppression.

> > write_script() takes the script body as stdin, not as an argument, and
> > you don't need to specify /bin/sh. What you have here works by
> > accident only because write_script() takes an optional second argument
> > specifying the shell to use in place of the default /bin/sh.
> > Nevertheless, it should really be written:
> >
> >     write_script print-args <<-\EOF
> >     echo $*
> >     EOF
> >
> > Patch [4/4] uses write_script() correctly.
>
> Ah. Sorry for misunderstanding. That explains why it works this way
> on macOS but it did _not_ work that way on Windows.

Sorry on my part too. I missed the `args` redirect in my example. It should be:

    write_script print-args <<-\EOF
    echo $* >args
    EOF



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux