fix sigpipe detection, use archive path given by client

This commit is contained in:
Connor Peet 2023-01-20 11:56:02 -08:00
parent c600c10579
commit 9bf083f846
No known key found for this signature in database
GPG key ID: CF8FD2EA0DBC61BD
2 changed files with 7 additions and 2 deletions

View file

@ -143,7 +143,7 @@ async fn handle_serve(
Some(AnyCodeServer::Socket(s)) => s,
Some(_) => return Err(MismatchedLaunchModeError().into()),
None => {
sb.setup(None).await?;
sb.setup(Some(params.archive_path.into())).await?;
sb.listen_on_default_socket().await?
}
};

View file

@ -85,7 +85,12 @@ export function setUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) =>
* @see https://github.com/microsoft/vscode-remote-release/issues/6481
*/
export function isSigPipeError(e: unknown): e is Error {
return !!e && typeof e === 'object' && (<any>e).code === 'EPIPE' && (<any>e).syscall === 'WRITE';
if (!e || typeof e !== 'object') {
return false;
}
const cast = e as Record<string, string | undefined>;
return cast.code === 'EPIPE' && cast.syscall?.toUpperCase() === 'WRITE';
}
export function onUnexpectedError(e: any): undefined {