nodejs child procee call casperjs args
用 Nodejs 的 child process 来执行命令传参数的时候,如果传的 是url,而正好url 包含 “/?” , 会引起异常
var path = require('path');
var childProcess = require('child_process');
var binPath = "casperjs.bat";
var childArgs = [
path.join(__dirname, _fetchRetiler(url)),url.replace("/?","?")
];
childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) {
callback(stdout);
});
例如 http://www.tesco.com/groceries/Product/Details/?id=273298972
而实际上 我们替换 "/?" 为 “?” 是可以的
替换后, 即可正常工作
页:
[1]