Skip to content

Commit 84b3a3b

Browse files
WardenGnawgregg-miskelly
authored andcommitted
Linesplit and ohmyzshfix (#1132)
* Renaming LaunchConfigurations To LaunchBrowserPlatformOptions. * Simplifying retrieving pipeTransport for attach The launch.json configuration is passed in via the args parameter. There is no need to read the launch.json file and find the correct configuration. The old method would only grab the first launch json name that matched. This change allows duplicate launch names but still grabs the correct pipeTransport. * Removing dead code * Fixes for OhMyZsh and Line Splitting Line splitting is dependant on program used. E.g. plink or ssh, so line splitting for the processes given is handling both \r\n and just \n. OhMyZsh fails with the current command. Fix is to add extra [] around existing []. * Fixing command to work for sh and adding error msg If a user decides to launch the remoteProcessPicker and clicks outside of the process picker window, it will try to attach to the process id 'null'. Adding in a new error message. * Simplifying command
1 parent 064fd71 commit 84b3a3b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/features/processPicker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class RemoteAttachPicker {
8484
placeHolder: "Select the process to attach to"
8585
};
8686
return vscode.window.showQuickPick(processes, attachPickOptions).then(item => {
87-
return item ? item.id : null;
87+
return item ? item.id : Promise.reject<string>(new Error("Could not find a process id to attach."));
8888
});
8989
});
9090
}
@@ -119,13 +119,13 @@ export class RemoteAttachPicker {
119119

120120
public static getRemoteOSAndProcesses(pipeCmd: string): Promise<AttachItem[]> {
121121
// Commands to get OS and processes
122-
const command = `uname && if [ $(uname) == "Linux" ] ; then ${RemoteAttachPicker.linuxPsCommand} ; elif [ $(uname) == "Darwin" ] ; ` +
123-
`then ${RemoteAttachPicker.osxPsCommand}; fi`;
122+
const command = `bash -c 'uname && if [ $(uname) == "Linux" ] ; then ${RemoteAttachPicker.linuxPsCommand} ; elif [ $(uname) == "Darwin" ] ; ` +
123+
`then ${RemoteAttachPicker.osxPsCommand}; fi'`;
124124

125125
return execChildProcessAndOutputErrorToChannel(`${pipeCmd} "${command}"`, null, RemoteAttachPicker._channel).then(output => {
126126
// OS will be on first line
127127
// Processess will follow if listed
128-
let lines = output.split(os.EOL);
128+
let lines = output.split(/\r?\n/);
129129

130130
if (lines.length == 0) {
131131
return Promise.reject<AttachItem[]>(new Error("Pipe transport failed to get OS and processes."));

0 commit comments

Comments
 (0)