Code Monkey home page Code Monkey logo

Comments (6)

xpac1985 avatar xpac1985 commented on July 20, 2024 1

Hey, I checked this, and it should be possible. You already found out that bash.exe -c "some command" can run a command in the bash. All files should be accessible, however the path has to be converted:
A path like C:\Users\youruser\somefile.txt would be /mnt/c/Users/youruser/somefile.txt.
The drive letter has to be a small letter, the : has to be removed, and the \ have to be replaced with / - that's it.

from vscode-ansible-vault.

dhoeric avatar dhoeric commented on July 20, 2024

Since I don't have Windows computer, welcome for contributing if anyone wants to help :)

I could provide a setup session for this.

from vscode-ansible-vault.

bartmeuris avatar bartmeuris commented on July 20, 2024

I don't have any experience with typescript or vscode plugins, but I suspect it would have something to do with how the ansible-vault process is launched.

Briefly looking at the code - I see there are no special options given to child_process.execSync when an encrypt or decrypt is triggered. If I look at the child_process.execSync documentation, the only Windows specific option I see there is the windowsHide option, which by default should show a window from a child process as far as I understand? I however never see a child window, and don't think that would be a desirable behavior anyway, setting this to true wouldn't hurt right?

Another issue is that the command touch ${keypath} && echo "${pass}" > ${keypath} is executed when the user is prompted for a password - which also fails on Windows. Opening the file and writing it yourself without spawning other processes would probably be the more portable/safer way.

from vscode-ansible-vault.

dhoeric avatar dhoeric commented on July 20, 2024

We are similar. I am also new to typescript and vscode thingy. This is just my "toy project" to avoid developer directly deal with terminal and remember ansible-vault command in my working space. Therefore you may feel the code is not really clean and organized... sorry 🙇

I have setup the dev env in Windows and it looks like cannot take the correct path in extension runtime.
I would try to define ansibleVault.useWSL for running C:\Windows\System32\bash.exe -lc "..." on every child_process command. But just feeling skeptical if bash.exe could access C:\Users\... paths.

Back to your question,

[child_process.exeSync] setting windowsHide to true wouldn't hurt right?

It's fine for debug purpose, and actually I could get the command output in my development env. Once I could regenerate the error, I could check the message and fix it.

touch ${keypath} && echo "${pass}" > ${keypath}

This command also requires bash.exe with WSL -- once we figure out the right way to make use of bash.exe in WSL, the problem solved.

Thanks again your comments and please let me know if I understand wrongly.

from vscode-ansible-vault.

tvories avatar tvories commented on July 20, 2024

I'd be happy to set up a session with you @dhoeric if you wanted to get Windows support for this working. I may be able to take a look at the code but I'm not too familiar with Typescript

from vscode-ansible-vault.

derekslenk avatar derekslenk commented on July 20, 2024

Hey, I checked this, and it should be possible. You already found out that bash.exe -c "some command" can run a command in the bash. All files should be accessible, however the path has to be converted:
A path like C:\Users\youruser\somefile.txt would be /mnt/c/Users/youruser/somefile.txt.
The drive letter has to be a small letter, the : has to be removed, and the \ have to be replaced with / - that's it.

It does not work as simple as you say, I have just tried.

from vscode-ansible-vault.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.