Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
fix nexe's upstream regex for main.cc patch (with debug logs)
Browse files Browse the repository at this point in the history
  • Loading branch information
hlolli committed Feb 22, 2020
1 parent 03f4b00 commit 0860c0c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ cache:
directories:
- node_modules
- "~/.m2"
- tmp
- "~/.boot/cache/lib"
- "~/.boot/cache/bin"
- yarn
before_install:
- eval "${MATRIX_EVAL}"
- sudo fallocate -l 4G /swapfile
Expand Down
37 changes: 19 additions & 18 deletions vendor/nexe/exe.js
Original file line number Diff line number Diff line change
Expand Up @@ -851,26 +851,27 @@ function _monkeyPatchMainCc(compiler, complete) {
encoding: 'utf8',
});

const finalContents = mainC.replace(
/(?<!int )ProcessGlobalArgs\(argv/g,
'0;//$&',
);
const finalContents = mainC
.toString()
.replace(/ProcessGlobalArgs\(argv([\s\S]*?)\)/g, '0');

// write the file contents
fs.writeFile(
mainPath,
finalContents,
{
try {
fs.writeFileSync(mainPath, finalContents, {
encoding: 'utf8',
},
function(err) {
if (err) {
_log('error', 'failed to write to', mainPath);
return process.exit(1);
}

return complete();
},
);
});
const { spawnSync } = require('child_process');
const child = spawnSync('sed', ['-n', '880-890p', mainPath]);

_log('error ' + child.error);
_log('stdout ' + child.stdout);
_log('stderr ' + child.stderr);
} catch (e) {
_log('error', 'failed to write to', mainPath);
return process.exit(1);
}
_log('src/node.cc patched to not check for cli arguments');
return complete();
}

/**
Expand Down

0 comments on commit 0860c0c

Please sign in to comment.