mirror of
https://github.com/syssecfsu/witty.git
synced 2025-01-11 20:52:43 +01:00
correct argument passing
This commit is contained in:
parent
97791896e1
commit
3a87f6a58c
8
main.go
8
main.go
@ -32,9 +32,9 @@ const (
|
||||
closeGracePeriod = 10 * time.Second
|
||||
)
|
||||
|
||||
func createPty(cmdline string) (*os.File, *exec.Cmd, error) {
|
||||
func createPty(cmdline []string) (*os.File, *exec.Cmd, error) {
|
||||
// Create a shell command.
|
||||
cmd := exec.Command(cmdline)
|
||||
cmd := exec.Command(cmdline[0], cmdline[1:]...)
|
||||
|
||||
// Start the command with a pty.
|
||||
ptmx, err := pty.Start(cmd)
|
||||
@ -155,7 +155,7 @@ func fromPtyStdout(ws *websocket.Conn, ptmx *os.File, done chan struct{}) {
|
||||
time.Sleep(closeGracePeriod)
|
||||
}
|
||||
|
||||
var cmdToExec string = "bash"
|
||||
var cmdToExec = []string{"bash"}
|
||||
|
||||
// handle websockets
|
||||
func wsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
@ -244,7 +244,7 @@ func main() {
|
||||
args := os.Args
|
||||
|
||||
if len(args) > 1 {
|
||||
cmdToExec = strings.Join(args[1:], " ")
|
||||
cmdToExec = args[1:]
|
||||
log.Println(cmdToExec)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user