我想在 linux 中使用 os/exec 庫在 golang 專案中啟動一個 .exe 檔案。
我通常使用“mono”來啟動 .exe 檔案,所以我做了:
command := make([]string, 7)
command = {"screen", "-S", screenName, "-d", "-m", "mono", exeFile}
cmd := exec.Command(command[0], command[1:]...)
cmd.Dir = "ConsoleClient"
_, err := cmd.Output() //*
我不能運行這個,我也試過cmd.Run()或cmd.Start()
*使用cmd.Start()(對我來說最好的方法)我沒有看到任何錯誤,但在結束螢屏沒有創建
它也未能^M在我的末尾添加command
uj5u.com熱心網友回復:
在第 2 行試試這個:
command = {"screen", "-dmS", screenName, "mono", exeFile}
引數應該在螢屏名稱之前。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/369729.html
上一篇:無法在眼鏡蛇引數中插入破折號
