From b67950f4635343aa665fc3faa1fead57f4857f0b Mon Sep 17 00:00:00 2001 From: Mattia Cabrini Date: Tue, 15 Aug 2023 11:55:58 +0200 Subject: [PATCH] Editor --- editor.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 editor.go diff --git a/editor.go b/editor.go new file mode 100644 index 0000000..a5a17b6 --- /dev/null +++ b/editor.go @@ -0,0 +1,22 @@ +// Copyright (c) 2023 Mattia Cabrini +// SPDX-License-Identifier: MIT + +package utility + +import ( + "os" + "os/exec" +) + +func Editor(editorPath string, path string) (err error) { + editor := exec.Command(editorPath, path) + editor.Stdin = os.Stdin + editor.Stderr = os.Stderr + editor.Stdout = os.Stdout + + if err = editor.Run(); err != nil { + return + } + + return +} -- 2.43.0