Skip to content

feat: Add vscodeipc subcommand for VS Code Extension #5326

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

Merged
merged 15 commits into from
Dec 18, 2022
Prev Previous commit
Next Next commit
Fix shell execution
  • Loading branch information
kylecarbs committed Dec 18, 2022
commit 25317686ba4cf72a23fceeefd034f5df59a3816f
5 changes: 3 additions & 2 deletions cli/vscodeipc/vscodeipc.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func (api *api) network(w http.ResponseWriter, r *http.Request) {

type ExecuteRequest struct {
Command string `json:"command"`
Stdin string `json:"stdin"`
}

type ExecuteResponse struct {
Expand Down Expand Up @@ -240,8 +241,8 @@ func (api *api) execute(w http.ResponseWriter, r *http.Request) {
execWriter := &execWriter{w, f}
session.Stdout = execWriter
session.Stderr = execWriter
session.Stdin = strings.NewReader(req.Command + "\n")
err = session.Start("sh")
session.Stdin = strings.NewReader(req.Stdin)
err = session.Start(req.Command)
if err != nil {
httpapi.Write(r.Context(), w, http.StatusInternalServerError, codersdk.Response{
Message: "Failed to start SSH session.",
Expand Down