dashlane-cli icon indicating copy to clipboard operation
dashlane-cli copied to clipboard

Password selection does not work on WSL2

Open damienwebdev opened this issue 2 years ago • 1 comments

? Please enter your master password: [hidden]
? What password would you like to get? My Password
Error: spawnSync /snapshot/dashlane-cli/node_modules/clipboardy/fallbacks/windows/clipboard_x86_64.exe ENOENT
    at Object.spawnSync (node:internal/child_process:1111:20)
    at Object.spawnSync (node:child_process:814:24)
    at Object.spawnSync (pkg/prelude/bootstrap.js:2087:31)
    at Function.sync (/snapshot/dashlane-cli/node_modules/execa/index.js:334:30)
    at Object.copySync (/snapshot/dashlane-cli/node_modules/clipboardy/lib/windows.js:14:29)
    at Object.<anonymous> (/snapshot/dashlane-cli/node_modules/clipboardy/index.js:45:14)
    at getPassword (/snapshot/dashlane-cli/dist/middleware/getPasswords.js:95:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Command.<anonymous> (/snapshot/dashlane-cli/dist/index.js:55:9)
    at async Command.parseAsync (/snapshot/dashlane-cli/node_modules/commander/lib/command.js:917:5) {
  errno: -2,

Looks like the CLI thinks I'm on windows within my WSL2 VM.

damienwebdev avatar Oct 18 '22 13:10 damienwebdev

Hello, you did not share the command you used but given the error, it seems that it's the copy to clipboard functionality that has an issue. I think it makes sense that ultimately it fallback to windows when it does not recognize the operating system. The dependency we are using to support clipboard might not be compatible with WSL. I think this should be reported there.

Can you confirm that using other output modes like JSON it is fine?

Mikescops avatar Oct 18 '22 13:10 Mikescops

Same problem here, on WSL and PowerShell:

PS> dcli password --debug
debug:   Connected to database.
debug:   Retrieving:
? What password would you like to get? ************ - *****************@******.***
Error: spawnSync C:\snapshot\dashlane-cli\node_modules\clipboardy\fallbacks\windows\clipboard_x86_64.exe ENOENT
    at Object.spawnSync (node:internal/child_process:1111:20)
    at Object.spawnSync (node:child_process:814:24)
    at Object.spawnSync (pkg/prelude/bootstrap.js:2087:31)
    at Function.sync (C:\snapshot\dashlane-cli\node_modules\execa\index.js:334:30)
    at Object.copySync (C:\snapshot\dashlane-cli\node_modules\clipboardy\lib\windows.js:14:29)
    at Object.<anonymous> (C:\snapshot\dashlane-cli\node_modules\clipboardy\index.js:45:14)
    at getPassword (C:\snapshot\dashlane-cli\dist\middleware\getPasswords.js:95:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Command.<anonymous> (C:\snapshot\dashlane-cli\dist\index.js:55:9)
    at async Command.parseAsync (C:\snapshot\dashlane-cli\node_modules\commander\lib\command.js:917:5) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawnSync C:\\snapshot\\dashlane-cli\\node_modules\\clipboardy\\fallbacks\\windows\\clipboard_x86_64.exe',
  path: 'C:\\snapshot\\dashlane-cli\\node_modules\\clipboardy\\fallbacks\\windows\\clipboard_x86_64.exe',
  spawnargs: [ '--copy' ],
  stdout: null,
  stderr: null,
  failed: true,
  signal: null,
  cmd: 'C:\\snapshot\\dashlane-cli\\node_modules\\clipboardy\\fallbacks\\windows\\clipboard_x86_64.exe --copy',
  timedOut: false
}

It works fine if I choose json or password output.

Of course "C:\snapshot\dashlane-cli\node_modules\clipboardy\fallbacks\windows\clipboard_x86_64.exe" does not exist on my computer. I installed dcli.exe from GitHub release.

Booyaabes avatar Jan 03 '23 10:01 Booyaabes

I confirm that downloading clipboard_x86_64.exe in "C:\snapshot\dashlane-cli\node_modules\clipboardy\fallbacks\windows\clipboard_x86_64.exe" make it work.

Booyaabes avatar Jan 03 '23 13:01 Booyaabes

Thanks a lot @Booyaabes for the debugging this, I'll have a look when I have more time on how to better support WSL2.

Mikescops avatar Jan 03 '23 17:01 Mikescops

FYI, I've just made some tests, dcli 1.4.0 resolve Windows Clipboard issue.

sebastienbaillet avatar Mar 06 '23 15:03 sebastienbaillet

@sebastienbaillet Yes, we fixed that, thanks for the double check, but it still doesn't work on WSL, @jboillot made a PR earlier on the dependency we're using to support it

Mikescops avatar Mar 06 '23 15:03 Mikescops

Thank you for the great work :)

sebastienbaillet avatar Mar 06 '23 15:03 sebastienbaillet

Will be included in the next release.

Mikescops avatar Mar 08 '23 09:03 Mikescops