i need to kill child and parrent process using syscall.Kill.
when i am using syscall.Kill in windows, getting erorr : “undefined: syscall.Kill”
i need to kill child and parrent process using syscall.Kill.
when i am using syscall.Kill in windows, getting erorr : “undefined: syscall.Kill”
The syscall
package is dependent on the operating system. syscall.Kill
is for Unix/Linux/Mac systems, not Windows.
Use godoc syscall
to get information on the syscall
package for your system. This is explained in the Overview section in the package documentation:
docs is too lengthy, could you please tell me for signal kill for windows platform.
like linux we can send signal to process through pkill command, in windows, is there any alternate ?
The overview section also states that the syscall package is deprecated:
Deprecated: this package is locked down. Callers should use the corresponding package in the The Go Programming Language repository instead. That is also where updates required by new systems or versions should be applied. See The syscall package for more information.
So check here instead.
Hi Shubham,
Is it necessary you have to use the syscall package?
If not, use github.com/shirou/gopsutil/process
Then,
p, err := process.NewProcess(pid) // Specify process id of parent
// handle error
for _, v := range p.Children(){
err = *v.Kill() // Kill each child
// handle error
}
p.Kill() // Kill the parent process
Hope this clears it
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.