Re: [PATCH 3/3] maintenance: use Windows scheduled tasks
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Nov 3, 2020, 19:06 UTC
- Message-ID
- <CAPig+cRE3RNkUCrmmTvVC4mm1crT+1OEU5zSwu80pjXmDdAkfg@mail.gmail.com>
- In-Reply-To
- <a9221cc4aa12192e9a691f8e1b77a3cc2d7e4952.1604412197.git.gitgitgadget@gmail.com>
On Tue, Nov 3, 2020 at 9:05 AM Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 8 quoted lines
> There is a deficiency in the current design. Windows has two kinds of > applications: GUI applications that start by "winmain()" and console > applications that start by "main()". Console applications are attached > to a new Console window if they are not already associated with a GUI > application. This means that every hour the scheudled task launches a > command window for the scheduled tasks. Not only is this visually > obtrusive, but it also takes focus from whatever else the user is > doing!
I wonder if you could use the technique explained in [1] to prevent the console window from popping up.
[1]: https://pureinfotech.com/prevent-command-window-appearing-scheduled-tasks-windows-10/
Show 7 quoted lines
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> > --- > diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh > @@ -441,6 +441,40 @@ test_expect_success MACOS_MAINTENANCE 'start and stop macOS maintenance' ' > +test_expect_success MINGW 'start and stop Windows maintenance' ' > + echo "echo \$@ >>args" >print-args && > + chmod a+x print-args &&
Same comments as my review of [2/3] regarding $@ and write_script().
> + rm -f args && > + GIT_TEST_CRONTAB="/bin/sh print-args" git maintenance start && > + cat args &&
Is this 'cat' leftover debugging gunk?
Show 9 quoted lines
> + # start registers the repo > + git config --get --global maintenance.repo "$(pwd)" && > + > + rm expect && > + for frequency in hourly daily weekly > + do > + echo "/create /tn Git Maintenance ($frequency) /f /xml .git/objects/schedule-$frequency.xml" >>expect \ > + || return 1 > + done &&
Rather than using >> within the loop, it's often simpler to capture the output of the for-loop in its entirety:
for frequency in hourly daily weekly
do
echo "/create ..." || return 1
done >expect &&However, in this case 'printf' may be even simpler:
printf "/create /tn ... .git/objects/schedule-%s.xml\n" \
hourly daily weekly >expect &&> + GIT_TEST_CRONTAB="/bin/sh print-args" git maintenance stop &&
Too many spaces before the 'git' command.