Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/agent/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function createAgentServer(
};

const getPreferredShell = () => {
return currentConfig.terminal?.preferredShell || process.env.SHELL;
return currentConfig.terminal?.preferredShell || process.env.SHELL || '/bin/bash';
};

const terminalHandler = new TerminalHandler({
Expand Down
23 changes: 21 additions & 2 deletions src/agent/systemd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function generateServiceFile(options: InstallOptions = {}): string {
`Environment=PERRY_PORT=${port}`,
`Environment=PERRY_CONFIG_DIR=${configDir}`,
`Environment=NODE_ENV=production`,
`Environment=SHELL=/bin/bash`,
];

if (options.noHostAccess) {
Expand Down Expand Up @@ -126,9 +127,27 @@ export async function installService(options: InstallOptions = {}): Promise<void
throw new Error('Installation failed: systemd configuration could not be completed');
}

try {
await runSystemctl(['start', SERVICE_NAME]);
console.log(`Service ${SERVICE_NAME} started`);
} catch (err) {
Comment on lines +130 to +133

This comment was marked as outdated.

const msg = err instanceof Error ? err.message : String(err);
console.error(`Warning: Could not start service. ${msg}`);
console.log('');
console.log('Installation complete, but service failed to start.');
console.log('Try starting manually:');
console.log(` systemctl --user start ${SERVICE_NAME}`);
console.log('');
console.log('To check status:');
console.log(` systemctl --user status ${SERVICE_NAME}`);
console.log('');
console.log('To view logs:');
console.log(` journalctl --user -u ${SERVICE_NAME} -f`);
return;
}

console.log('');
console.log('Installation complete! To start the agent:');
console.log(` systemctl --user start ${SERVICE_NAME}`);
console.log('Installation complete! Agent is now running.');
console.log('');
console.log('To check status:');
console.log(` systemctl --user status ${SERVICE_NAME}`);
Expand Down
Loading