Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix bug for path containing whitespaces#35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jdneo merged 2 commits intomasterfromcs/bug
Mar 28, 2018
Merged
Show file tree
Hide file tree
Changes fromall 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
2 changes: 1 addition & 1 deletionsrc/commands/show.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,7 +49,7 @@ async function showProblemInternal(channel: vscode.OutputChannel, id: string): P

const outdir: string = await selectWorkspaceFolder();
await fse.ensureDir(outdir);
const result: string = await executeCommand(channel, "node", [leetCodeBinaryPath, "show", id, "-gx", "-l", language, "-o", outdir]);
const result: string = await executeCommand(channel, "node", [leetCodeBinaryPath, "show", id, "-gx", "-l", language, "-o",`"${outdir}"`]);
const reg: RegExp = /\* Source Code:\s*(.*)/;
const match: RegExpMatchArray | null = result.match(reg);
if (match && match.length >= 2) {
Expand Down
2 changes: 1 addition & 1 deletionsrc/commands/submit.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,7 @@ export async function submitSolution(channel: vscode.OutputChannel, uri?: vscode
}

try {
const result: string = await executeCommand(channel, "node", [leetCodeBinaryPath, "submit", filePath]);
const result: string = await executeCommand(channel, "node", [leetCodeBinaryPath, "submit",`"${filePath}"`]);
await showResultFile(result);
} catch (error) {
await promptForOpenOutputChannel("Failed to submit the solution. Please open the output channel for details.", DialogType.error, channel);
Expand Down
6 changes: 3 additions & 3 deletionssrc/commands/test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,7 +47,7 @@ export async function testSolution(channel: vscode.OutputChannel, uri?: vscode.U
let result: string | undefined;
switch (choice.value) {
case ":default":
result = await executeCommand(channel, "node", [leetCodeBinaryPath, "test", filePath]);
result = await executeCommand(channel, "node", [leetCodeBinaryPath, "test",`"${filePath}"`]);
break;
case ":direct":
const testString: string | undefined = await vscode.window.showInputBox({
Expand All@@ -57,15 +57,15 @@ export async function testSolution(channel: vscode.OutputChannel, uri?: vscode.U
ignoreFocusOut: true,
});
if (testString) {
result = await executeCommand(channel, "node", [leetCodeBinaryPath, "test", filePath, "-t", `"${testString.replace(/"/g, "")}"`]);
result = await executeCommand(channel, "node", [leetCodeBinaryPath, "test",`"${filePath}"`, "-t", `"${testString.replace(/"/g, "")}"`]);
}
break;
case ":file":
const testFile: vscode.Uri[] | undefined = await showFileSelectDialog();
if (testFile && testFile.length) {
const input: string = await fse.readFile(testFile[0].fsPath, "utf-8");
if (input.trim()) {
result = await executeCommand(channel, "node", [leetCodeBinaryPath, "test", filePath, "-t", `"${input.replace(/"/g, "").replace(/\r?\n/g, "\\n")}"`]);
result = await executeCommand(channel, "node", [leetCodeBinaryPath, "test",`"${filePath}"`, "-t", `"${input.replace(/"/g, "").replace(/\r?\n/g, "\\n")}"`]);
} else {
vscode.window.showErrorMessage("The selected test file must not be empty.");
}
Expand Down
2 changes: 1 addition & 1 deletionsrc/leetCodeManager.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,7 @@ class LeetCodeManager extends EventEmitter implements ILeetCodeManager {
try {
const userName: string | undefined = await new Promise(async (resolve: (res: string | undefined) => void, reject: (e: Error) => void): Promise<void> => {
let result: string = "";
const childProc: cp.ChildProcess = cp.spawn("node", [leetCodeBinaryPath, "user", "-l"]);
const childProc: cp.ChildProcess = cp.spawn("node", [leetCodeBinaryPath, "user", "-l"], { shell: true });
childProc.stdout.on("data", (data: string | Buffer) => {
data = data.toString();
result = result.concat(data);
Expand Down
2 changes: 1 addition & 1 deletionsrc/shared.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@
import * as path from "path";
import * as vscode from "vscode";

export const leetCodeBinaryPath: string = path.join(__dirname, "..", "..", "node_modules", "leetcode-cli", "bin", "leetcode");
export const leetCodeBinaryPath: string =`"${path.join(__dirname, "..", "..", "node_modules", "leetcode-cli", "bin", "leetcode")}"`;

export interface IQuickItemEx<T> extends vscode.QuickPickItem {
value: T;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp