Skip to content

Commit d1f69a2

Browse files
committed
patchapp.applescript: avoided to timeout around 1min
1 parent 5073664 commit d1f69a2

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

patchapp.applescript

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2323
# SOFTWARE.
2424

25-
set n to 330 -- 308 /tmp/bibunsho7-patch.log
26-
set progress total steps to n
25+
-- 700 lines /tmp/bibunsho7-patch.log => 3.5min
26+
set progressTimeout to 5 -- minutes
27+
set progressMaxN to (progressTimeout * 60 * 10)
28+
set progress total steps to progressMaxN
2729
set progress description to "Patch.app: 実行中..."
2830
set progress additional description to "待機中..."
2931

@@ -37,15 +39,20 @@ try
3739
-- activate the progress bar intentionally
3840
activate
3941

40-
repeat with i from 1 to n
42+
repeat with i from 1 to progressMaxN
4143
delay 0.1
42-
4344
-- update progress description and completed steps
4445
set progrMsg to do shell script "tail -n 1" & space & patchLog & space & "| fold"
4546
set progress additional description to progrMsg
4647
set i to do shell script "wc -l" & space & patchLog & space & "| sed \"s, *,,\" | cut -f1 -d \" \""
4748

48-
set progress completed steps to i
49+
set progress completed steps to (i * progressTimeout)
50+
51+
if progrMsg = "cjk-gs-integrate [DEBUG]: overwriting with the new one ..."
52+
set progress description to "Patch.app: 実行中... (この処理にしばらく時間がかかる場合があります)"
53+
else
54+
set progress description to "Patch.app: 実行中..."
55+
end if
4956

5057
--
5158
if progrMsg = "+ exit 0" then
@@ -54,16 +61,16 @@ try
5461
error number -128
5562
end if
5663
end repeat
64+
-- some exception handling
5765
if progrMsg = "+ exit 0" then
5866
else if progrMsg = "cp: /Volumes/Bibunsho7-patch/ptex-fontmaps/maps/hiragino*: No such file or directory"
5967
error number -2
60-
else if progrMsg = "cjk-gs-integrate [DEBUG]: overwriting with the new one ..." then
61-
error number -1
6268
else
6369
error number -128
6470
end if
71+
6572
-- quit
66-
set progress completed steps to n
73+
set progress completed steps to progressMaxN
6774
set progress additional description to "完了"
6875
activate
6976
display alert "完了"
@@ -77,8 +84,6 @@ on error message number errn
7784

7885
if errn = -2 then
7986
display alert plzChkLog & "複数個の Bibunsho7-patch-<バージョン>.dmg を開いています。"
80-
else if errn = -1 then
81-
display alert plzChkLog & "ターミナルで直接、 sudo " & quoted form of (POSIX path of (path to resource "Patch.sh")) & " を実行すると、成功するかもしれません。"
8287
else
8388
set progrMsg to do shell script "tail -n 2" & space & patchLog & space & "| fold"
8489
set progress additional description to progrMsg

0 commit comments

Comments
 (0)