mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-27 06:44:56 +00:00
Use node.execPath in runOutOfProcess()
This commit is contained in:
parent
3934413180
commit
61126aef53
@ -61,20 +61,16 @@ function copyFileToTempDir(filename) {
|
|||||||
return tmpFile.name;
|
return tmpFile.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function runOutOfProcess(nodeJsFilePath) {
|
function runOutOfProcess() {
|
||||||
var nodeArgs = Array.prototype.slice.call(arguments);
|
const args = Array.prototype.slice.call(arguments);
|
||||||
let tmpDir = tmp.dirSync();
|
let tmpDir = tmp.dirSync();
|
||||||
let content = fs.readFileSync(nodeJsFilePath, 'utf8');
|
console.log(`runOutOfProcess : ${args.join(' ')}`);
|
||||||
let tmpFile = tmp.fileSync({ dir: tmpDir.name });
|
|
||||||
fs.appendFileSync(tmpFile.fd, content, { encoding: 'utf8' });
|
|
||||||
nodeArgs[0] = tmpFile.name;
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
console.log('runOutOfProcess command\n node ' + nodeArgs.join(" "));
|
execFile(process.execPath, args, {cwd: tmpDir.name}, (error, stdout, stderr) => {
|
||||||
const child = execFile('node', nodeArgs, { cwd: tmpDir.name }, (error, stdout, stderr) => {
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error("runOutOfProcess failed\n" + error);
|
console.error("runOutOfProcess failed\n", error);
|
||||||
reject(new Error(`Running ${nodeJsFilePath} failed. error: ${error}`));
|
reject(new Error(`Running ${modulePath} failed. error: ${error}`));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user