This code will always use absolute paths to files and ignores the basePath (or rather the cwd). You need to do the same thing here as you are doing above for Windows:

	child.stdin.end(targets.map(function (p) {
		var x = p.indexOf(cwd);
		if (x >= 0) {
			p = p.replace(cwd, '');
			if (/^(\/|\\)/.test(p)) {
				p = p.substring(1);
			}
		}
		if (!p) {
			p = '.';
		}
		return p;
	}).join('\n'));