fix(daemon): Ensure TSPM runtime dir exists and improve daemon startup/debug output
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-08-28 - 3.0.2 - fix(daemon)
|
||||||
|
Ensure TSPM runtime dir exists and improve daemon startup/debug output
|
||||||
|
|
||||||
|
- Create ~/.tspm directory before starting the daemon to avoid missing-directory errors
|
||||||
|
- Start daemon child process with stdio inherited when TSPM_DEBUG=true to surface startup errors during debugging
|
||||||
|
- Add warning and troubleshooting guidance when daemon process starts but does not respond (suggest checking socket file and using TSPM_DEBUG)
|
||||||
|
- Bump package version to 3.0.1
|
||||||
|
|
||||||
## 2025-08-28 - 3.0.0 - BREAKING CHANGE(daemon)
|
## 2025-08-28 - 3.0.0 - BREAKING CHANGE(daemon)
|
||||||
Refactor daemon and service management: remove IPC auto-spawn, add TspmServiceManager, tighten IPC/client/CLI behavior and tests
|
Refactor daemon and service management: remove IPC auto-spawn, add TspmServiceManager, tighten IPC/client/CLI behavior and tests
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@git.zone/tspm",
|
"name": "@git.zone/tspm",
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a no fuzz process manager",
|
"description": "a no fuzz process manager",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tspm',
|
name: '@git.zone/tspm',
|
||||||
version: '3.0.0',
|
version: '3.0.2',
|
||||||
description: 'a no fuzz process manager'
|
description: 'a no fuzz process manager'
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,10 @@ export class TspmDaemon {
|
|||||||
public async start(): Promise<void> {
|
public async start(): Promise<void> {
|
||||||
console.log('Starting TSPM daemon...');
|
console.log('Starting TSPM daemon...');
|
||||||
|
|
||||||
|
// Ensure the TSPM directory exists
|
||||||
|
const fs = await import('fs/promises');
|
||||||
|
await fs.mkdir(paths.tspmDir, { recursive: true });
|
||||||
|
|
||||||
// Check if another daemon is already running
|
// Check if another daemon is already running
|
||||||
if (await this.isDaemonRunning()) {
|
if (await this.isDaemonRunning()) {
|
||||||
throw new Error('Another TSPM daemon instance is already running');
|
throw new Error('Another TSPM daemon instance is already running');
|
||||||
|
@@ -37,9 +37,10 @@ export function registerDaemonCommand(smartcli: plugins.smartcli.Smartcli) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Start daemon as a detached background process
|
// Start daemon as a detached background process
|
||||||
|
// Use 'inherit' for stdio to see any startup errors when debugging
|
||||||
const daemonProcess = spawn(process.execPath, [daemonScript], {
|
const daemonProcess = spawn(process.execPath, [daemonScript], {
|
||||||
detached: true,
|
detached: true,
|
||||||
stdio: 'ignore',
|
stdio: process.env.TSPM_DEBUG === 'true' ? 'inherit' : 'ignore',
|
||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
TSPM_DAEMON_MODE: 'true',
|
TSPM_DAEMON_MODE: 'true',
|
||||||
@@ -62,6 +63,13 @@ export function registerDaemonCommand(smartcli: plugins.smartcli.Smartcli) {
|
|||||||
'\nNote: This daemon will run until you stop it or logout.',
|
'\nNote: This daemon will run until you stop it or logout.',
|
||||||
);
|
);
|
||||||
console.log('For automatic startup, use "tspm enable" instead.');
|
console.log('For automatic startup, use "tspm enable" instead.');
|
||||||
|
} else {
|
||||||
|
console.warn('\n⚠️ Warning: Daemon process started but is not responding.');
|
||||||
|
console.log('The daemon may have crashed on startup.');
|
||||||
|
console.log('\nTo debug, try:');
|
||||||
|
console.log(' TSPM_DEBUG=true tspm daemon start');
|
||||||
|
console.log('\nOr check if the socket file exists:');
|
||||||
|
console.log(` ls -la ~/.tspm/tspm.sock`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disconnect from the daemon after starting
|
// Disconnect from the daemon after starting
|
||||||
|
Reference in New Issue
Block a user