-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expected
Description
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption).
- OS version and name: Windows_NT x64 10.0.19042
- Poetry version: 1.1.4
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/karrtikr/783e232d92b0d12d812230b0a9e028cc
Issue
Hi VSCode Python extension dev here 👋 We're planning to support Poetry envs in the extension (microsoft/vscode-python#8372 (comment)).
In order to discover environments, we planned to run poetry env list command. The command works fine in terminal when cwd is in case-exact state.
But when drive begins with a lowercase c: instead (which is also a valid path on Windows), things don't seem to work. Every other command other than This can be seen when executed via poetry env list works fine.nodejs.child_process API, it returns empty stdout.
import { exec } from 'child_process';
function shellExecute(command: string, options: ShellOptions = {}): Promise<ExecutionResult<string>> {
return new Promise((resolve, reject) => {
const callback = (e: any, stdout: any, stderr: any) => {
if (e && e !== null) {
reject(e);
} else {
resolve({ stderr: stderr && stderr.length > 0 ? stderr : undefined, stdout });
}
};
exec(command, options, callback);
});
}
const result1 = await shellExec('poetry env list', {
cwd: 'C:\\Users\\karraj\\OneDrive - Microsoft\\Desktop\\folders\\poetry@2-tutorial-project',
});
console.log('poetry env list', result1.stdout);
// Prints:
// poetry env list poetry_2-tutorial-project-6hnqYwvD-py3.7
// poetry_2-tutorial-project-6hnqYwvD-py3.8
// poetry_2-tutorial-project-6hnqYwvD-py3.9
const result2 = await shellExec('poetry env info -p', {
cwd: 'C:\\Users\\karraj\\OneDrive - Microsoft\\Desktop\\folders\\poetry@2-tutorial-project',
});
console.log('poetry env info', result2.stdout);
// Prints:
// poetry env info C:\Users\karraj\OneDrive - Microsoft\Desktop\folders\poetry@2-tutorial-project\.venv
// Now the drive letter begins with `c:` instead of `C:`.
const result3 = await shellExec('poetry env list', {
cwd: 'c:\\Users\\karraj\\OneDrive - Microsoft\\Desktop\\folders\\poetry@2-tutorial-project',
});
console.log('poetry env list', result3.stdout);
// Prints:
// poetry env list
const result4 = await shellExec('poetry env info -p', {
cwd: 'c:\\Users\\karraj\\OneDrive - Microsoft\\Desktop\\folders\\poetry@2-tutorial-project',
});
console.log('poetry env info', result4.stdout);
// Prints:
// poetry env info c:\Users\karraj\OneDrive - Microsoft\Desktop\folders\poetry@2-tutorial-project\.venv
// ^Interesting: drive letter begins with `c:` in the output as well.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expected
