util

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package util provides common utilities for Gas Town.

Package util provides utility functions for Gas Town. This file was created as part of an E2E polecat workflow test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtomicWriteFile

func AtomicWriteFile(path string, data []byte, perm os.FileMode) error

AtomicWriteFile writes data to a file atomically. It first writes to a temporary file, then renames it to the target path. This prevents data corruption if the process crashes during write. The rename operation is atomic on POSIX systems.

func AtomicWriteJSON

func AtomicWriteJSON(path string, v interface{}) error

AtomicWriteJSON writes JSON data to a file atomically. It first writes to a temporary file, then renames it to the target path. This prevents data corruption if the process crashes during write. The rename operation is atomic on POSIX systems.

func ExecRun

func ExecRun(workDir, cmd string, args ...string) error

ExecRun runs a command in the specified directory. If the command fails, stderr content is included in the error message.

func ExecWithOutput

func ExecWithOutput(workDir, cmd string, args ...string) (string, error)

ExecWithOutput runs a command in the specified directory and returns stdout. If the command fails, stderr content is included in the error message.

func ProcessExists

func ProcessExists(pid int) bool

ProcessExists checks if a process with the given PID exists. It sends signal 0 to the process, which doesn't actually send a signal but does perform error checking to see if the process exists.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL