fix(daemon): Ensure TSPM runtime dir exists and improve daemon startup/debug output

This commit is contained in:
2025-08-28 16:29:41 +00:00
parent 6141b26530
commit ae4148c82f
5 changed files with 23 additions and 3 deletions

View File

@@ -37,9 +37,10 @@ export function registerDaemonCommand(smartcli: plugins.smartcli.Smartcli) {
);
// Start daemon as a detached background process
// Use 'inherit' for stdio to see any startup errors when debugging
const daemonProcess = spawn(process.execPath, [daemonScript], {
detached: true,
stdio: 'ignore',
stdio: process.env.TSPM_DEBUG === 'true' ? 'inherit' : 'ignore',
env: {
...process.env,
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.',
);
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