@whoz-oss/coday-server 0.0.0-workstream-forge.134 → 0.0.0-workstream-setup.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.js +13 -3
- package/package.json +1 -1
- package/server.js +62 -55
package/bin.js
CHANGED
|
@@ -6,15 +6,25 @@ import { fileURLToPath } from 'url';
|
|
|
6
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = dirname(__filename);
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* `coday-server [provision|agentos|factory|server] [--configDir <dir>] ...`
|
|
11
|
+
*
|
|
12
|
+
* Runs the compiled server bundle with the given arguments. Without a command it runs everything in
|
|
13
|
+
* one process (Express + AgentOS + Factory). The Nx tasks of the generated runtime workspace call
|
|
14
|
+
* the commands (see apps/web).
|
|
15
|
+
*/
|
|
9
16
|
const serverPath = resolve(__dirname, 'server.js');
|
|
10
17
|
const args = process.argv.slice(2);
|
|
11
18
|
|
|
12
|
-
//
|
|
13
|
-
const child = spawn(
|
|
19
|
+
// No shell: the arguments (paths with spaces) must reach the server untouched.
|
|
20
|
+
const child = spawn(process.execPath, [serverPath, ...args], {
|
|
14
21
|
stdio: 'inherit',
|
|
15
|
-
shell: true
|
|
16
22
|
});
|
|
17
23
|
|
|
24
|
+
for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
|
|
25
|
+
process.on(signal, () => child.kill(signal));
|
|
26
|
+
}
|
|
27
|
+
|
|
18
28
|
child.on('exit', (code) => {
|
|
19
29
|
process.exit(code || 0);
|
|
20
30
|
});
|