spawn static method
Spawns command with args in cwd. Throws
LspServerUnavailableException when the executable cannot be started
(e.g. not on PATH) so the lsp tool degrades to a clean error
result instead of crashing.
Implementation
static Future<IoLspTransport> spawn({
required String command,
required List<String> args,
required String cwd,
}) async {
final Process process;
try {
process = await Process.start(
command,
args,
workingDirectory: cwd,
mode: ProcessStartMode.normal,
);
} on Object catch (error) {
throw LspServerUnavailableException(
'cannot start LSP server `$command`: $error. '
'Is it installed and on PATH?',
cause: error,
);
}
return IoLspTransport._(process);
}