From 94194eca0e2a0985ec18c31d1994f0a90d9dd083 Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Sun, 6 Oct 2024 18:06:54 +0200 Subject: [PATCH] fix(resetter/shell): cleanup properly in the event of the remote srv being unreachable Signed-off-by: Pierre Fenoll --- Makefile | 3 +-- README.md | 5 ----- pkg/resetter/shell/singleton.go | 8 +++++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 23ca47fc..23a3461a 100644 --- a/Makefile +++ b/Makefile @@ -36,8 +36,7 @@ debug: SHELL = /bin/bash -o pipefail debug: all ./$(EXE) lint ./$(EXE) fuzz --seed=fm_AdrZpxEHTjUJMuZEfKq5tYqngxgFi5EQPNGeFzYnwbjexR8jdfir7pYX82 ; [[ $$? = 6 ]] -# ./$(EXE) fuzz --exclude-tags=failing --progress=bar - ./$(EXE) fuzz --exclude-tags=failing --progress=ci + ./$(EXE) fuzz --exclude-tags=failing --progress=ci #=bar distclean: clean $(if $(wildcard dist/),rm -r dist/) diff --git a/README.md b/README.md index df3b88d0..31d2f87e 100644 --- a/README.md +++ b/README.md @@ -274,8 +274,3 @@ Report bugs [on the project page](https://github.com/FuzzyMonkeyCo/monkey/issues ## License See [LICENSE](./LICENSE) - - -https://github.com/google/fuzzing/blob/master/docs/structure-aware-fuzzing.md#fuzzing-stateful-apis - -https://github.com/google/fuzztest diff --git a/pkg/resetter/shell/singleton.go b/pkg/resetter/shell/singleton.go index e8353018..13ecafcf 100644 --- a/pkg/resetter/shell/singleton.go +++ b/pkg/resetter/shell/singleton.go @@ -34,9 +34,11 @@ var ( ) func (s *Resetter) signal(verb, param string) { - io.WriteString(s.stdin, verb) - io.WriteString(s.stdin, param) - io.WriteString(s.stdin, "\n") + if s.stdin != nil { // Is `nil` if it never started (e.g. remote is unreachable) + io.WriteString(s.stdin, verb) + io.WriteString(s.stdin, param) + io.WriteString(s.stdin, "\n") + } } func writeMainScript(name string, paths []string) (err error) {