forked from nodegui/nodegui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqode.js
More file actions
executable file
·40 lines (32 loc) · 1.1 KB
/
qode.js
File metadata and controls
executable file
·40 lines (32 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env node
var os = require('os');
var path = require('path');
var qodeConfig = require('@nodegui/qode');
var managePath = require('manage-path');
var qtConfig = require('../config/qtConfig');
var proc = require('child_process');
// Add Qt's bin to the path of Qode so that it can find the dll's
var alterPath = managePath(process.env);
alterPath.unshift(path.join(qtConfig.qtHome, 'bin'));
// Add Qt's lib to LD_LIBRARY_PATH so linux can find the libs when bundled with webpack
if(os.platform == 'linux') {
var oldLD_PATH = process.env.LD_LIBRARY_PATH ?? "";
process.env.LD_LIBRARY_PATH = oldLD_PATH + ":" + path.join(qtConfig.qtHome, 'lib');
}
var child = proc.spawn(qodeConfig.qodePath, process.argv.slice(2), {
stdio: 'inherit',
windowsHide: false,
env: process.env,
});
child.on('close', function(code) {
process.exit(code);
});
const handleTerminationSignal = function(signal) {
process.on(signal, function signalHandler() {
if (!child.killed) {
child.kill(signal);
}
});
};
handleTerminationSignal('SIGINT');
handleTerminationSignal('SIGTERM');