mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
desktop: fix spawn EINVAL error on build
This commit is contained in:
46
apps/desktop/patches/node-gyp-build+4.8.0.patch
Normal file
46
apps/desktop/patches/node-gyp-build+4.8.0.patch
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
diff --git a/node_modules/node-gyp-build/bin.js b/node_modules/node-gyp-build/bin.js
|
||||||
|
index 3fbcdf0..7ca3ab5 100644
|
||||||
|
--- a/node_modules/node-gyp-build/bin.js
|
||||||
|
+++ b/node_modules/node-gyp-build/bin.js
|
||||||
|
@@ -16,7 +16,8 @@ if (!buildFromSource()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
function build () {
|
||||||
|
- var args = [os.platform() === 'win32' ? 'node-gyp.cmd' : 'node-gyp', 'rebuild']
|
||||||
|
+ var win32 = os.platform() === 'win32'
|
||||||
|
+ var args = [win32 ? 'node-gyp.cmd' : 'node-gyp', 'rebuild']
|
||||||
|
|
||||||
|
try {
|
||||||
|
var pkg = require('node-gyp/package.json')
|
||||||
|
@@ -27,7 +28,7 @@ function build () {
|
||||||
|
]
|
||||||
|
} catch (_) {}
|
||||||
|
|
||||||
|
- proc.spawn(args[0], args.slice(1), { stdio: 'inherit' }).on('exit', function (code) {
|
||||||
|
+ proc.spawn(args[0], args.slice(1), { stdio: 'inherit', shell: win32, windowsHide: true }).on('exit', function (code) {
|
||||||
|
if (code || !process.argv[3]) process.exit(code)
|
||||||
|
exec(process.argv[3]).on('exit', function (code) {
|
||||||
|
process.exit(code)
|
||||||
|
@@ -45,15 +46,18 @@ function preinstall () {
|
||||||
|
|
||||||
|
function exec (cmd) {
|
||||||
|
if (process.platform !== 'win32') {
|
||||||
|
- var shell = os.platform() === 'android' ? 'sh' : '/bin/sh'
|
||||||
|
- return proc.spawn(shell, ['-c', '--', cmd], {
|
||||||
|
+ var shell = os.platform() === 'android' ? 'sh' : true
|
||||||
|
+ return proc.spawn(cmd, [], {
|
||||||
|
+ shell,
|
||||||
|
stdio: 'inherit'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
- return proc.spawn(process.env.comspec || 'cmd.exe', ['/s', '/c', '"' + cmd + '"'], {
|
||||||
|
+ return proc.spawn(cmd, [], {
|
||||||
|
windowsVerbatimArguments: true,
|
||||||
|
- stdio: 'inherit'
|
||||||
|
+ stdio: 'inherit',
|
||||||
|
+ shell: true,
|
||||||
|
+ windowsHide: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
@@ -37,7 +37,10 @@ const webAppPath = path.resolve(path.join(__dirname, "..", "..", "web"));
|
|||||||
await fs.rm("./build/", { force: true, recursive: true });
|
await fs.rm("./build/", { force: true, recursive: true });
|
||||||
|
|
||||||
if (args.rebuild || !existsSync(path.join(webAppPath, "build"))) {
|
if (args.rebuild || !existsSync(path.join(webAppPath, "build"))) {
|
||||||
await exec(`cd ${webAppPath} && npm run build:desktop`);
|
await exec(
|
||||||
|
"npx nx build:desktop @notesnook/web",
|
||||||
|
path.join(__dirname, "..", "..", "..")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// temporary until there's support for prebuilt binaries for linux ARM
|
// temporary until there's support for prebuilt binaries for linux ARM
|
||||||
|
|||||||
Reference in New Issue
Block a user