Skip to content

Commit 2531768

Browse files
committed
Fix shell execution
1 parent 6bad9ae commit 2531768

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cli/vscodeipc/vscodeipc.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ func (api *api) network(w http.ResponseWriter, r *http.Request) {
192192

193193
type ExecuteRequest struct {
194194
Command string `json:"command"`
195+
Stdin string `json:"stdin"`
195196
}
196197

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

0 commit comments

Comments
 (0)