File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,6 +126,20 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
126126
127127 type Item = ProcessInfo | TopProcess ;
128128
129+ const cleanUNCPrefix = ( value : string ) : string => {
130+ if ( value . indexOf ( '\\\\?\\' ) === 0 ) {
131+ return value . substr ( 4 ) ;
132+ } else if ( value . indexOf ( '\\??\\' ) === 0 ) {
133+ return value . substr ( 4 ) ;
134+ } else if ( value . indexOf ( '"\\\\?\\' ) === 0 ) {
135+ return '"' + value . substr ( 5 ) ;
136+ } else if ( value . indexOf ( '"\\??\\' ) === 0 ) {
137+ return '"' + value . substr ( 5 ) ;
138+ } else {
139+ return value ;
140+ }
141+ } ;
142+
129143 const execMain = path . basename ( process . execPath ) . replace ( / / g, '` ' ) ;
130144 const script = URI . parse ( require . toUrl ( 'vs/base/node/ps-win.ps1' ) ) . fsPath . replace ( / / g, '` ' ) ;
131145 const commandLine = `${ script } -ProcessName ${ execMain } -MaxSamples 3` ;
@@ -159,9 +173,10 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
159173 } else {
160174 load = - 1 ;
161175 }
176+ let commandLine = cleanUNCPrefix ( item . commandLine ) ;
162177 processItems . set ( item . processId , {
163- name : findName ( item . commandLine ) ,
164- cmd : item . commandLine ,
178+ name : findName ( commandLine ) ,
179+ cmd : commandLine ,
165180 pid : item . processId ,
166181 ppid : item . parentProcessId ,
167182 load : load ,
You can’t perform that action at this time.
0 commit comments