-
Notifications
You must be signed in to change notification settings - Fork 30
Log spawning of processes #756
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,16 @@ | ||
| import * as cp from 'child_process'; | ||
| import { traceVerbose } from '../../../common/logging'; | ||
| import { traceError, traceInfo } from '../../../common/logging'; | ||
| import { StopWatch } from '../../../common/stopWatch'; | ||
|
|
||
| export async function runCommand(command: string): Promise<string | undefined> { | ||
| return new Promise((resolve) => { | ||
| const timer = new StopWatch(); | ||
| cp.exec(command, (err, stdout) => { | ||
| if (err) { | ||
| traceVerbose(`Error running command: ${command}`, err); | ||
| traceError(`Error running command: ${command} (${timer.elapsedTime})`, err); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surely if success is |
||
| resolve(undefined); | ||
| } else { | ||
| traceInfo(`Ran ${command} in ${timer.elapsedTime}`); | ||
| resolve(stdout?.trim()); | ||
| } | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ export async function isUvInstalled(log?: LogOutputChannel): Promise<boolean> { | |
| if (available.completed) { | ||
| return available.promise; | ||
| } | ||
|
|
||
| log?.info(`Running: uv --version`); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the code is right here, as Not sure why, I'd try to resolve this in debt, as logger shouldn't be optional. we either turn off logging or the like, but wouldn't make the logger component optional. |
||
| const proc = ch.spawn('uv', ['--version']); | ||
| proc.on('error', () => { | ||
| available.resolve(false); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,7 @@ import { Installable } from '../common/types'; | |
| import { shortVersion, sortEnvironments } from '../common/utils'; | ||
| import { CondaEnvManager } from './condaEnvManager'; | ||
| import { getCondaHookPs1Path, getLocalActivationScript } from './condaSourcingUtils'; | ||
| import { StopWatch } from '../../common/stopWatch'; | ||
|
|
||
| export const CONDA_PATH_KEY = `${ENVS_EXTENSION_ID}:conda:CONDA_PATH`; | ||
| export const CONDA_PREFIXES_KEY = `${ENVS_EXTENSION_ID}:conda:CONDA_PREFIXES`; | ||
|
|
@@ -202,6 +203,8 @@ async function _runConda( | |
| ): Promise<string> { | ||
| const deferred = createDeferred<string>(); | ||
| args = quoteArgs(args); | ||
| const timer = new StopWatch(); | ||
| deferred.promise.finally(() => traceInfo(`Ran conda in ${timer.elapsedTime}: ${conda} ${args.join(' ')}`)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We haven't logged this at all, now we will. |
||
| const proc = ch.spawn(conda, args, { shell: true }); | ||
|
|
||
| token?.onCancellationRequested(() => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't logged this at all, now we will.
I believe we've seen delays in reading registry in the past as well.