Skip to content

Commit bea0f78

Browse files
committed
fix exec output
1 parent 0ba44ef commit bea0f78

File tree

7 files changed

+21
-17
lines changed

7 files changed

+21
-17
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ decompress-bin: ## decompress binary files
1616
@echo 'run command: tar -zxvf ./mdtk_bin_VERSION.tar.gz'
1717

1818
install-linux-amd64: ## Install mdtk to /usr/local/bin/
19-
cp ./sources/mdtk_bin/linux_amd64/mdtk /usr/local/bin/mdtk
19+
sudo cp ./sources/mdtk_bin/linux_amd64/mdtk /usr/local/bin/mdtk
2020
install-linux-arm64: ## Install mdtk to /usr/local/bin/
21-
cp ./sources/mdtk_bin/linux_arm64/mdtk /usr/local/bin/mdtk
21+
sudo cp ./sources/mdtk_bin/linux_arm64/mdtk /usr/local/bin/mdtk
2222

2323
size:
2424
@cd ./sources/mdtk_bin/linux_amd64 && ls -lh

Taskfile.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ docker compose build
1313
~~~bash task:docker:build-plain -- Build all container (--progress=plain)
1414
docker compose build --progress=plain
1515
~~~
16+
~~~bash task:docker:status
17+
docker stats
18+
~~~
1619

1720
## Git
1821
~~~bash task:git:git-push -- Git add all & commit & push

memo/TODO.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,9 @@
5959
- 同じ数値のgroupは辞書順
6060
- [x] groupの一覧だけ表示する機能
6161
- v0.5.0以降
62-
- [ ] 関数化して読み込むembedded commentを作成
62+
- [x] 関数化して読み込むembedded commentを作成
6363
- `#func> funcname group:task -- args...`
64+
- v0.5.1以降
65+
- [x] execの出力がストリーム出力に対応していなかったので修正
66+
- 全部終わってから書き出していた
67+

sources/mdtk/exec/exec.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package exec
33
import (
44
"fmt"
55
"os"
6-
"strings"
76
"os/exec"
87
"mdtk/config"
98
)
@@ -24,23 +23,21 @@ func Run(code string, quiet_mode bool) {
2423
execcode := ToExecCode(code, "EOS")
2524
// fmt.Println(execcode)
2625

27-
out, err := exec.Command(GetShell(), "-c", execcode).CombinedOutput()
28-
if quiet_mode {
29-
out = nil
26+
cmd := exec.Command(GetShell(), "-c", execcode)
27+
if !quiet_mode {
28+
cmd.Stdout = os.Stdout
3029
}
30+
cmd.Stderr = os.Stderr
31+
32+
err := cmd.Run()
33+
3134
if err != nil {
32-
PrintExecError(out)
35+
errtext := "mdtk: Command exec error."
36+
fmt.Println(errtext, "Error command was run in", os.Args)
3337
os.Exit(1)
3438
}
3539

3640
// 実行したコマンドの結果を出力
37-
fmt.Print(string(out))
41+
// fmt.Print(string(out))
3842
}
3943

40-
func PrintExecError(out []byte) {
41-
errtext := "mdtk: Command exec error."
42-
fmt.Print(string(out))
43-
if !strings.Contains(string(out), errtext) {
44-
fmt.Println(errtext, "Error command was run in", os.Args)
45-
}
46-
}

sources/mdtk/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION=0.5.1
1+
VERSION=0.5.2

sources/mdtk_bin/linux_amd64/mdtk

-4 KB
Binary file not shown.

sources/mdtk_bin/linux_arm64/mdtk

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)