Closed vorburger closed 3 months ago
First, this package vscode-wakatime is treating the option's entire string as one program to run:
child_process.spawn treats the first argument as the program's executable name, and only treats it a shell command (ie. interpreted by sh with sh syntax) if the shell
option was true, which it isn't.
Second, that line in the documentation is quite misleading, at least in regards to wakatime-cli
's behavior. In reality the string is not a shell command, it is a space-separated list of an executable and its arguments. This extension should probably mimick this behavior.
Edit: I thought this was wakatime/vscode-wakatime. Corrected.
Edit: Oh, it was moved.
Hi @vorburger that's not the way it should be used api_key_vault_cmd = /usr/bin/echo hi
. So, instead you might replace with
api_key_vault_cmd = pass any_defined_key
@gandarez with vscode-wakatime
, that will not work - not even the pass
command would work. vscode-wakatime
treats the whole value as one executable name (including the spaces).
This is a problem in vscode-wakatime
, specifically here:
public async getApiKeyFromVaultCmd(): Promise<string> {
try {
const apiKeyCmd = await this.getSettingAsync<string>('settings', 'api_key_vault_cmd');
if (!apiKeyCmd) return '';
const options = Desktop.buildOptions();
const proc = child_process.spawn(apiKeyCmd, options);
where it treats the whole string as one executable. I've filed https://github.com/wakatime/vscode-wakatime/pull/386 to fix it.
The /usr/bin/echo hi
is just fact a placeholder to refer to some command returning a proper API key.
I see. Let's just wait for @alanhamlett input.
The
api_key_vault_cmd
configuration option which according to https://github.com/wakatime/wakatime-cli/blob/develop/USAGE.md can be used to specify a "shell command to get api key from vault" fails for me, on Linux, for example for a simple test like this in.wakatime.cfg
:I'm getting this in the VSC Developer Tools:
I'm intentionally opening this as a separate bug from wakatime/vscode-wakatime#295 which seems to be Windows with specific restricted policy.
This is with
WakaTime.vscode-wakatime@24.4.0
(fromcode --list-extensions --show-versions
).