Allow special characters in password

This commit is contained in:
timoxa0 2024-07-26 20:41:46 +05:00
parent 298e7c56da
commit c0f74a254a

View file

@ -3,8 +3,6 @@ package cmd
import (
"io"
"io/fs"
"git.timoxa0.su/timoxa0/lon-tool/image"
"git.timoxa0.su/timoxa0/lon-tool/utils"
"net"
"os"
"regexp"
@ -12,6 +10,9 @@ import (
"strings"
"time"
"git.timoxa0.su/timoxa0/lon-tool/image"
"git.timoxa0.su/timoxa0/lon-tool/utils"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
"github.com/timoxa0/goadb/adb"
@ -342,9 +343,10 @@ var deployCmd = &cobra.Command{
<-doneChan2
adbd.KillForwardAll()
out, err := adbd.RunCommand(pterm.Sprintf("postinstall %s %s > /dev/null 2>&1; echo $?", username, password))
pi_cmd := pterm.Sprintf("postinstall \"%s\" \"%s\" > /dev/null 2>&1; echo $?", username, strings.ReplaceAll(password, "\"", "\\\""))
out, err := adbd.RunCommand(pi_cmd)
out = strings.TrimRight(out, "\n")
logger.Debug("Postinstall", logger.Args("out", out, "err", err))
logger.Debug("Postinstall", logger.Args("cmd", pi_cmd, "out", out, "err", err))
if out != "0" || err != nil {
logger.Error("Postinstall failed. Reflash stock rom and try again", logger.Args("Device error", out, "Go error", err))
} else {