env not properly applied

This commit is contained in:
olebeck 2023-03-09 14:58:54 +01:00
parent c94d7038e9
commit c5e7237273
7 changed files with 22 additions and 8 deletions

1
.gitignore vendored
View File

@ -17,6 +17,7 @@ __debug_bin
keys.db
/skins/
/worlds/
/packs/
/dist/
/builds/
/updates/

View File

@ -110,7 +110,7 @@ for (platform_name, archs, ext) in PLATFORMS:
]
args.append("./cmd/bedrocktool")
print(args)
out = subprocess.run(args)
out = subprocess.run(args, env=env)
out.check_returncode()
for arch in archs:

View File

@ -35,7 +35,7 @@ func (c *CLI) Init() bool {
func (c *CLI) Start(ctx context.Context, cancel context.CancelFunc) error {
flag.Parse()
utils.InitDNS()
utils.InitExtraDebug()
utils.InitExtraDebug(ctx)
subcommands.Execute(ctx)
return nil
}

View File

@ -167,7 +167,7 @@ func (g *GUI) Start(ctx context.Context, cancel context.CancelFunc) error {
}
utils.InitDNS()
utils.InitExtraDebug()
utils.InitExtraDebug(ctx)
wg.Add(1)
go func() {

View File

@ -78,7 +78,7 @@ func (c *InteractiveCLI) Start(ctx context.Context, cancel context.CancelFunc) e
flag.Parse()
InitDNS()
InitExtraDebug()
InitExtraDebug(ctx)
subcommands.Execute(ctx)

View File

@ -116,6 +116,10 @@ func PacketLogger(header packet.Header, payload []byte, src, dst net.Addr) {
pk = &packet.Unknown{PacketID: header.PacketID}
}
if pk.ID() == packet.IDRequestNetworkSettings {
ClientAddr = src
}
defer func() {
if recoveredErr := recover(); recoveredErr != nil {
logrus.Errorf("%T: %w", pk, recoveredErr)

View File

@ -198,7 +198,7 @@ func CfbDecrypt(data []byte, key []byte) ([]byte, error) {
return data, nil
}
func InitExtraDebug() {
func InitExtraDebug(ctx context.Context) {
if !Options.ExtraDebug {
return
}
@ -211,7 +211,10 @@ func InitExtraDebug() {
if err != nil {
logrus.Error(err)
} else {
defer logPlain.Close()
go func() {
<-ctx.Done()
logPlain.Close()
}()
}
// open gpg log
@ -219,13 +222,19 @@ func InitExtraDebug() {
if err != nil {
logrus.Error(err)
} else {
defer logCrypt.Close()
go func() {
<-ctx.Done()
logCrypt.Close()
}()
// encrypter for the log
logCryptEnc, err = crypt.Encer("packets.log", logCrypt)
if err != nil {
logrus.Error(err)
} else {
defer logCryptEnc.Close()
go func() {
<-ctx.Done()
logCryptEnc.Close()
}()
}
}