vercel / pkg

Package your Node.js project into an executable
https://npmjs.com/pkg
MIT License
24.33k stars 1.02k forks source link

there is something evil bug when we start a exe which is created by pkg #2009

Closed introspection3 closed 11 months ago

introspection3 commented 1 year ago

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

18.5

What operating system are you using?

windows ,maybe linux too

What CPU architecture are you using?

amd64

What Node versions, OSs and CPU architectures are you building for?

node18-win-arm64

Describe the Bug

when we use some code to start a exe which is created by pkg directly ,it will work well. but when we do somthing else (unzip) and then start exe,it will not work .please don't wonder my code.

   os.Chdir(currentDir)
p, err := os.StartProcess(binaryName, []string{}, &os.ProcAttr{Dir: currentDir, Files: []*os.File{nil, nil, nil}})
if err != nil {
    log.Info("restartWindowsApp app start failed " + err.Error())
} else {
    log.Info(p.Pid) //have pi,but no process in tasklist
}

Expected Behavior

can work well.

To Reproduce

unzip app.zip and then start app binary.

   os.Chdir(currentDir)
p, err := os.StartProcess(binaryName, []string{}, &os.ProcAttr{Dir: currentDir, Files: []*os.File{nil, nil, nil}})
if err != nil {
    log.Info("restartWindowsApp app start failed " + err.Error())
} else {
    log.Info(p.Pid) //have pid,but no process in windows tasklist
}