pgserve 1.1.2 → 1.1.3-rc.1
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/pgserve-wrapper.cjs +15 -2
- package/package.json +1 -1
package/bin/pgserve-wrapper.cjs
CHANGED
|
@@ -55,15 +55,28 @@ const scriptPath = path.join(__dirname, 'pglite-server.js');
|
|
|
55
55
|
// Spawn bun with the actual script, inherit all stdio
|
|
56
56
|
const child = spawn(bunPath, [scriptPath, ...process.argv.slice(2)], {
|
|
57
57
|
stdio: 'inherit',
|
|
58
|
-
windowsHide: true
|
|
58
|
+
windowsHide: true,
|
|
59
|
+
// Detach on Windows to prevent handle inheritance and EBUSY errors during npx cleanup
|
|
60
|
+
detached: isWindows
|
|
59
61
|
});
|
|
60
62
|
|
|
63
|
+
// On Windows, unreference the child to allow wrapper to exit independently
|
|
64
|
+
if (isWindows) {
|
|
65
|
+
child.unref();
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
child.on('error', (err) => {
|
|
62
69
|
console.error('Failed to start pgserve:', err.message);
|
|
63
70
|
process.exit(1);
|
|
64
71
|
});
|
|
65
72
|
|
|
66
|
-
child.on('exit', (code, signal) => {
|
|
73
|
+
child.on('exit', async (code, signal) => {
|
|
74
|
+
// On Windows, wait briefly for all file handles to be released
|
|
75
|
+
// This prevents EBUSY errors when npx tries to clean up the cache
|
|
76
|
+
if (isWindows) {
|
|
77
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
78
|
+
}
|
|
79
|
+
|
|
67
80
|
if (signal) {
|
|
68
81
|
process.kill(process.pid, signal);
|
|
69
82
|
} else {
|