# command **Repository Path**: mnt-ltd/command ## Basic Information - **Project Name**: command - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-03-06 - **Last Updated**: 2025-04-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # command 对`os/exec`的简易封装,防止出现`孤儿进程` ## 使用示例 ### 执行相应指令 ```go command.ExecCommand("ebook-convert", []string{"1.txt","1.pdf"}, 30*time.Minute) ``` ### 关闭可能存在的孤儿进程 ```go ... c := make(chan os.Signal, 1) signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) go func() { s := <-c fmt.Println("get signal:", s) fmt.Println("close child process...") command.CloseChildProccess() fmt.Println("close child process done.") fmt.Println("exit.") os.Exit(0) }() ... ```