简体   繁体   English

添加一个 makepkg dlagent,它接受非零退出代码

[英]add a makepkg dlagent, which accept a non zero exit code

For some downloads lgogdownloader return always the exit code 141 after a successful download.对于某些下载,lgogdownloader 在成功下载后总是返回退出代码 141。 Because of this the dlagent should catch this exit code.因此,dlagent 应该捕获此退出代码。

I have already try some dlagents, but non of this works:我已经尝试了一些 dlagents,但这些都不起作用:

DLAGENTS+=('gogdownloader::/usr/bin/lgogdownloader --download-file=%u -o %o || /usr/bin/test $? -eq 141')

Error: unrecognised option '-eq'
DLAGENTS+=('gogdownloader::/usr/bin/bash -c \"lgogdownloader --download-file=%u -o %o || test $? -eq 141\"')

--download-file=gogdownloader://2146639313/en3installer0: -c: line 0: unexpected EOF while looking for matching `"'
--download-file=gogdownloader://2146639313/en3installer0: -c: line 1: syntax error: unexpected end of file

Your problem is that you incorrectly escape the " inside a ' string. This reproduces your 2nd error message:您的问题是您错误地转义了'字符串中的" 。这会重现您的第二条错误消息:

$ eval '/usr/bin/bash -c \"echo hello world\"'
hello: -c: line 0: unexpected EOF while looking for matching `"'
hello: -c: line 1: syntax error: unexpected end of file

The 1st occurence of \" is treated as that literal sequence, while the 2nd occurence escapes the quotation, leaving you with an never-ending string. Removing the escape, you get the desired result:第一次出现\"被视为该文字序列,而第二次出现转义引号,给您留下一个永无止境的字符串。删除转义符,您将获得所需的结果:

$ eval '/usr/bin/bash -c "echo hello world"'
hello world

How msrd0 has mention you can use a separate script: msrd0 如何提到您可以使用单独的脚本:

DLAGENTS+=("gogdownloader::./catch_gogdownloader_error141.sh %u %o")
#!/bin/bash
lgogdownloader --download-file=$1 -o $2 || test $? -eq 141

But I think this is more a workaround than a real solution.但我认为这更像是一种解决方法,而不是真正的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM