start method
Starts a session for request, returning a live ShellSession.
May throw if the command is invalid or the node is at capacity; the node
runtime translates failures into a node.session.rejected message.
Implementation
@override
Future<ShellSession> start(ShellRequest request) async {
if (allowCommand != null && !allowCommand!(request)) {
throw ProcessException(
request.command ?? defaultShell,
request.args,
'Command not permitted by node policy',
);
}
final (executable, args) = resolveShellInvocation(request, defaultShell);
final process = await Process.start(
executable,
args,
workingDirectory: request.cwd ?? workingDirectory,
environment: {...baseEnvironment, ..._ptyEnv(request), ...request.env},
includeParentEnvironment: true,
);
return ProcessShellSession(
process,
shellFamily: classifyShellFamily(executable),
);
}