-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: devcontainer read config environment variables (#715)
Signed-off-by: Toma Puljak <[email protected]>
- Loading branch information
Showing
2 changed files
with
69 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2024 Daytona Platforms Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package ssh | ||
|
||
import ( | ||
"io" | ||
"strings" | ||
) | ||
|
||
func (c *Client) GetEnv(logWriter io.Writer) ([]string, error) { | ||
session, err := c.NewSession() | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer session.Close() | ||
|
||
session.Stdout = logWriter | ||
session.Stderr = logWriter | ||
|
||
out, err := session.CombinedOutput("env") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
output := strings.TrimRight(string(out), "\n") | ||
return strings.Split(output, "\n"), nil | ||
} |