mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-27 09:24:06 +01:00
:file: 移除文件锁 https://github.com/siyuan-note/siyuan/issues/6010
This commit is contained in:
parent
56129699b9
commit
69a9713776
38 changed files with 193 additions and 438 deletions
|
|
@ -1,24 +0,0 @@
|
|||
// SiYuan - Build Your Eternal Digital Garden
|
||||
// Copyright (c) 2020-present, b3log.org
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//go:build !windows
|
||||
|
||||
package util
|
||||
|
||||
import "os/exec"
|
||||
|
||||
func CmdAttr(cmd *exec.Cmd) {
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
// SiYuan - Build Your Eternal Digital Garden
|
||||
// Copyright (c) 2020-present, b3log.org
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func CmdAttr(cmd *exec.Cmd) {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
|
||||
}
|
||||
|
|
@ -417,14 +417,14 @@ func Kill(pid string) {
|
|||
} else {
|
||||
kill = exec.Command("kill", "-9", pid)
|
||||
}
|
||||
CmdAttr(kill)
|
||||
gulu.CmdAttr(kill)
|
||||
kill.CombinedOutput()
|
||||
}
|
||||
|
||||
func PidByPort(port string) (ret string) {
|
||||
if gulu.OS.IsWindows() {
|
||||
cmd := exec.Command("cmd", "/c", "netstat -ano | findstr "+port)
|
||||
CmdAttr(cmd)
|
||||
gulu.CmdAttr(cmd)
|
||||
data, err := cmd.CombinedOutput()
|
||||
if nil != err {
|
||||
logging.LogErrorf("netstat failed: %s", err)
|
||||
|
|
@ -444,7 +444,7 @@ func PidByPort(port string) (ret string) {
|
|||
}
|
||||
|
||||
cmd := exec.Command("lsof", "-Fp", "-i", ":"+port)
|
||||
CmdAttr(cmd)
|
||||
gulu.CmdAttr(cmd)
|
||||
data, err := cmd.CombinedOutput()
|
||||
if nil != err {
|
||||
logging.LogErrorf("lsof failed: %s", err)
|
||||
|
|
@ -507,7 +507,7 @@ func getPandocVer(binPath string) (ret string) {
|
|||
}
|
||||
|
||||
cmd := exec.Command(binPath, "--version")
|
||||
CmdAttr(cmd)
|
||||
gulu.CmdAttr(cmd)
|
||||
data, err := cmd.CombinedOutput()
|
||||
if nil == err && strings.HasPrefix(string(data), "pandoc") {
|
||||
parts := bytes.Split(data, []byte("\n"))
|
||||
|
|
@ -527,7 +527,7 @@ func IsValidPandocBin(binPath string) bool {
|
|||
}
|
||||
|
||||
cmd := exec.Command(binPath, "--version")
|
||||
CmdAttr(cmd)
|
||||
gulu.CmdAttr(cmd)
|
||||
data, err := cmd.CombinedOutput()
|
||||
if nil == err && strings.HasPrefix(string(data), "pandoc") {
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue