@@ -36,7 +36,8 @@ const localize: nls.LocalizeFunc = nls.loadMessageBundle();
3636export const CppSourceStr : string = "C/C++" ;
3737export const configPrefix : string = "C/C++: " ;
3838
39- let prevCrashFile : string ;
39+ let prevMacCrashFile : string ;
40+ let prevCppCrashFile : string ;
4041export let clients : ClientCollection ;
4142let activeDocument : vscode . TextDocument | undefined ;
4243let ui : LanguageStatusUI ;
@@ -914,7 +915,7 @@ function onShowRefCommand(arg?: TreeNode): void {
914915
915916function reportMacCrashes ( ) : void {
916917 if ( process . platform === "darwin" ) {
917- prevCrashFile = "" ;
918+ prevMacCrashFile = "" ;
918919 const home : string = os . homedir ( ) ;
919920 const crashFolder : string = path . resolve ( home , "Library/Logs/DiagnosticReports" ) ;
920921 fs . stat ( crashFolder , ( err ) => {
@@ -932,10 +933,10 @@ function reportMacCrashes(): void {
932933 if ( event !== "rename" ) {
933934 return ;
934935 }
935- if ( ! filename || filename === prevCrashFile ) {
936+ if ( ! filename || filename === prevMacCrashFile ) {
936937 return ;
937938 }
938- prevCrashFile = filename ;
939+ prevMacCrashFile = filename ;
939940 if ( ! filename . startsWith ( "cpptools" ) ) {
940941 return ;
941942 }
@@ -964,7 +965,7 @@ export function usesCrashHandler(): boolean {
964965
965966export function watchForCrashes ( crashDirectory : string ) : void {
966967 if ( crashDirectory !== "" ) {
967- prevCrashFile = "" ;
968+ prevCppCrashFile = "" ;
968969 fs . stat ( crashDirectory , ( err ) => {
969970 const crashObject : Record < string , string > = { } ;
970971 if ( err ?. code ) {
@@ -980,10 +981,10 @@ export function watchForCrashes(crashDirectory: string): void {
980981 if ( event !== "rename" ) {
981982 return ;
982983 }
983- if ( ! filename || filename === prevCrashFile ) {
984+ if ( ! filename || filename === prevCppCrashFile ) {
984985 return ;
985986 }
986- prevCrashFile = filename ;
987+ prevCppCrashFile = filename ;
987988 if ( ! filename . startsWith ( "cpptools" ) ) {
988989 return ;
989990 }
@@ -1125,7 +1126,7 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, er
11251126
11261127 const lines : string [ ] = data . split ( "\n" ) ;
11271128 let addressData : string = ".\n." ;
1128- data = crashFile + "\n" ;
1129+ data = ( crashFile . startsWith ( "cpptools-srv" ) ? "cpptools-srv.txt" : crashFile ) + "\n" ;
11291130 const filtPath : string | null = which . sync ( "c++filt" , { nothrow : true } ) ;
11301131 const isMac : boolean = process . platform === "darwin" ;
11311132 const startStr : string = isMac ? " _" : "<" ;
@@ -1202,7 +1203,9 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, er
12021203 logCppCrashTelemetry ( data , addressData ) ;
12031204
12041205 await util . deleteFile ( path . resolve ( crashDirectory , crashFile ) ) . catch ( logAndReturn . undefined ) ;
1205- void util . deleteDirectory ( crashDirectory ) . catch ( logAndReturn . undefined ) ;
1206+ if ( crashFile === "cpptools.txt" ) {
1207+ void util . deleteDirectory ( crashDirectory ) . catch ( logAndReturn . undefined ) ;
1208+ }
12061209}
12071210
12081211export function deactivate ( ) : Thenable < void > {
0 commit comments