Git一直在给我这个错误
0 [main] sh (47116) C:\Users\Marcus\AppData\Local\GitHub\PortableGit_c7e0cbde92ba565cb218a521411d0e854079a28c\usr\bin\sh.exe: *** fatal error - cygheap base mismatch detected - 0x11C7400/0x1297400.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version. The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution. Rebooting is also suggested if you
are unable to find another cygwin DLL.
0 …Run Code Online (Sandbox Code Playgroud) 我利用集群来推迟应用程序中的工作负载,并且工作人员可能必须执行的一项任务是写入文件。但是,我在让工作线程写入文件时遇到一些问题。以下是我使用的测试用例:
这会工作得很好:
var fs = require('fs');
var path = require('path');
var request = require('request');
var filepath = path.join(__dirname, "image.jpg");
request({url:"http://i.imgur.com/InnEHyN.jpg"}).pipe(fs.createWriteStream(filepath));
var filepath2 = path.join(__dirname, "test.txt");
fs.writeFile(filepath2, "Sample Text");
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试从工作线程执行这些操作时,它们不会发生。我没有从控制台收到任何错误或输出,它似乎只是默默地失败了。
var fs = require('fs');
var path = require('path');
var request = require('request');
var cluster = require('cluster');
if(cluster.isMaster) {
cluster.fork();
}else {
var filepath = path.join(__dirname, "image.jpg");
request({url:"http://i.imgur.com/InnEHyN.jpg"}).pipe(fs.createWriteStream(filepath));
var filepath2 = path.join(__dirname, "test.txt");
fs.writeFile(filepath2, "Sample Text");
}
Run Code Online (Sandbox Code Playgroud)
另外,如果我使用此处fs-extra找到的库,我可以调用并创建文件。然而,即使那里有一个空文件,我似乎也无法通过管道或使用该函数写入它。fse.ensureFileSync(filepath)fs.writeFile