Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 deletion src/features/execution/execUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function quoteArg(arg: string): string {
export function quoteArg(arg: string): string {
if (arg.indexOf(' ') >= 0 && !(arg.startsWith('"') && arg.endsWith('"'))) {
return `"${arg}"`;
}
Expand Down
10 changes: 5 additions & 5 deletions src/features/execution/runAsTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {
Uri,
WorkspaceFolder,
} from 'vscode';
import { PythonTaskExecutionOptions } from '../../api';
import { getWorkspaceFolder } from '../../common/workspace.apis';
import { PythonEnvironment } from '../../api';
import { PythonEnvironment, PythonTaskExecutionOptions } from '../../api';
import { executeTask } from '../../common/tasks.apis';
import { getWorkspaceFolder } from '../../common/workspace.apis';
import { quoteArg } from './execUtils';

function getWorkspaceFolderOrDefault(uri?: Uri): WorkspaceFolder | TaskScope {
const workspace = uri ? getWorkspaceFolder(uri) : undefined;
Expand All @@ -25,8 +25,8 @@ export async function runAsTask(
): Promise<TaskExecution> {
const workspace: WorkspaceFolder | TaskScope = getWorkspaceFolderOrDefault(options.project?.uri);

const executable =
environment.execInfo?.activatedRun?.executable ?? environment.execInfo?.run.executable ?? 'python';
let executable = environment.execInfo?.activatedRun?.executable ?? environment.execInfo?.run.executable ?? 'python';
quoteArg(executable);
const args = environment.execInfo?.activatedRun?.args ?? environment.execInfo?.run.args ?? [];
const allArgs = [...args, ...options.args];

Expand Down