我有一个Windows 7和一个Windows Server 2012奴隶,Jenkins代理和Cygwin已经设置好了.我想避免Cygwin,只使用Git for Windows附带的Git Bash shell(我认为它叫做msysgit).所以我重命名C:\cygwin64为C:\cygwin64.bak,C:\cygwin64\bin从路径中删除,然后重新启动.
Windows 2012框现在运行正常,(Unix)shell脚本运行$OSTYPE = msys,和uname = MSYS_NT-6.3(表明Git Bash shell正在运行).
Windows 7框不会运行任何内容,并给出以下错误:
远程构建在工作区C:\ Users\Jenkins\workspace\TEST
[win7] $ sh -xe C:\ Users\jenkins\AppData\Local\Temp\hudson5047939025129374618.sh
系统找不到指定的文件
FATAL:命令执行
java.io.IOException 失败:无法运行程序"sh"(在目录"C:\ Users\Jenkins\workspace\TEST"中):CreateProcess
error = 2,系统找不到指定的文件.
在java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
所以我的问题是,如何配置Jenkins使用C:\Program Files\Git\bin\sh.exe或C:\Program Files\Git\usr\bin\bash.exe运行shell脚本?
Git 文档讨论了默认的全局 git 配置文件位置($XDG_CONFIG_HOME/git/config或~/.gitconfig),但没有提供告诉 git 命令忽略该文件的方法。
我正在寻找一个环境变量,可能称为$GIT_CONFIG_NOGLOBAL(类似于$GIT_CONFIG_NOSYSTEM),或传递给 git 命令的标志(例如--ignore-global-config)。我需要它,因为我的标准 git 设置(尤其是commit.gpgsign true)会干扰使用 git 的测试套件。
如果目前不可能,我可以在他们的问题跟踪器上提出问题。
当我尝试编译此代码(playground)时:
fn main() {
let iter = "abc123".chars().filter(&|&c: &char| c.is_digit(10));
match iter.clone().take(3).count() {
3 => println!("{}", iter.collect::<String>()),
_ => {}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
error: borrowed value does not live long enough
--> test.rs:2:41
|
2 | let iter = "abc123".chars().filter(&|c: &char| c.is_digit(10));
| ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value only lives until here
| |
| temporary value created here
...
7 | }
| - temporary value needs to live until here
|
= note: consider using a `let` …Run Code Online (Sandbox Code Playgroud)