Skip to content
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

Support using Buf binary in WSL #288

Open
F21 opened this issue Dec 16, 2024 · 0 comments
Open

Support using Buf binary in WSL #288

F21 opened this issue Dec 16, 2024 · 0 comments

Comments

@F21
Copy link

F21 commented Dec 16, 2024

I am using intellij with the buf plugin on Windows 11. I use WSL in Windows terminal as my terminal and all my CLI tools run in WSL.

In the buf plugin, I configured it to use the Buf binary in WSL: \\wsl.localhost\Ubuntu\usr\local\bin\buf. This causes an error when I attempt to use buf to reformat my protobuf:

com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "\\wsl.localhost\Ubuntu\usr\local\bin\buf" (in directory "C:\Work\project"): CreateProcess error=193, %1 is not a valid Win32 application
	at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:384)
	at com.intellij.execution.process.OSProcessHandler.startProcess(OSProcessHandler.java:85)
	at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:45)
	at com.intellij.execution.process.KillableProcessHandler.<init>(KillableProcessHandler.java:41)
	at com.intellij.execution.process.ColoredProcessHandler.<init>(ColoredProcessHandler.java:23)
	at com.intellij.execution.process.ScriptRunnerUtil.lambda$execute$2(ScriptRunnerUtil.java:77)
	at com.intellij.execution.process.ScriptRunnerUtil.execute(ScriptRunnerUtil.java:142)
	at com.intellij.execution.process.ScriptRunnerUtil.execute(ScriptRunnerUtil.java:100)
	at com.intellij.execution.process.ScriptRunnerUtil.execute(ScriptRunnerUtil.java:77)
	at build.buf.intellij.annotator.BufAnalyzeUtils$runBufCommand$2.invokeSuspend(BufAnalyzeUtils.kt:210)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.internal.SoftLimitedDispatcher$Worker.run(SoftLimitedDispatcher.kt:125)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:608)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:873)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:763)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:750)
Caused by: java.io.IOException: Cannot run program "\\wsl.localhost\Ubuntu\usr\local\bin\buf" (in directory "C:\Work\project"): CreateProcess error=193, %1 is not a valid Win32 application
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1170)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089)
	at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:463)
	at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:469)
	at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:374)
	... 17 more
Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application
	at java.base/java.lang.ProcessImpl.create(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:500)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:159)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1126)
	... 21 more

In addition, it is also not able to detect imported buf protos (such as "buf/validate/validate.proto") correctly.

I think it would be really neat if the plugin can support WSL as a lot of Windows users use WSL for their tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant