Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 4 additions & 35 deletions src/features/processPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,43 +61,20 @@ export class RemoteAttachPicker {
return Promise.reject<string>(new Error("Name not defined in current configuration."));
}

// Build path for launch.json to find pipeTransport
const vscodeFolder: string = path.join(vscode.workspace.rootPath, '.vscode');
let launchJsonPath: string = path.join(vscodeFolder, 'launch.json');

// Read launch.json
let json: any = JSON.parse(fs.readFileSync(launchJsonPath).toString());

// Find correct pipeTransport via selected name
let config;
let configIdx: number;
for (configIdx = 0; configIdx < json.configurations.length; ++configIdx) {
if (json.configurations[configIdx].name === name) {
config = json.configurations[configIdx];
break;
}
}

if (configIdx == json.configurations.length) {
// Name not found in list of given configurations.
return Promise.reject<string>(new Error(name + " could not be found in configurations."));
}

if (!config.pipeTransport || !config.pipeTransport.debuggerPath) {
if (!args.pipeTransport || !args.pipeTransport.debuggerPath) {
// Missing PipeTransport and debuggerPath, prompt if user wanted to just do local attach.
return Promise.reject<string>(new Error("Configuration \"" + name + "\" in launch.json does not have a " +
"pipeTransport argument with debuggerPath for pickRemoteProcess. Use pickProcess for local attach."));
} else {
let pipeProgram = config.pipeTransport.pipeProgram;
let pipeArgs = config.pipeTransport.pipeArgs;
let platformSpecificPipeTransportOptions = RemoteAttachPicker.getPlatformSpecificPipeTransportOptions(config);
let pipeProgram = args.pipeTransport.pipeProgram;
let pipeArgs = args.pipeTransport.pipeArgs;
let platformSpecificPipeTransportOptions = RemoteAttachPicker.getPlatformSpecificPipeTransportOptions(args);

if (platformSpecificPipeTransportOptions) {
pipeProgram = platformSpecificPipeTransportOptions.pipeProgram || pipeProgram;
pipeArgs = platformSpecificPipeTransportOptions.pipeArgs || pipeArgs;
}


let argList = RemoteAttachPicker.createArgumentList(pipeArgs);
let pipeCmd: string = `"${pipeProgram}" ${argList}`;
return RemoteAttachPicker.getRemoteOSAndProcesses(pipeCmd).then(processes => {
Expand Down Expand Up @@ -170,14 +147,6 @@ export class RemoteAttachPicker {
}
});
}

public static getRemoteProcesses(pipeCmd: string, os: string): Promise<AttachItem[]> {
const psCommand = os === 'darwin' ? RemoteAttachPicker.osxPsCommand : RemoteAttachPicker.linuxPsCommand;

return execChildProcessAndOutputErrorToChannel(`${pipeCmd} ${psCommand}`, null, RemoteAttachPicker._channel).then(output => {
return sortProcessEntries(PsOutputParser.parseProcessFromPs(output), os);
});
}
}

class Process {
Expand Down