scp

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecSCPBytesFunc

type ExecSCPBytesFunc func(bytes []byte, dest string) error
var ExecSCPBytes ExecSCPBytesFunc = func(bytes []byte, dest string) error {
	tmpfile, err := os.CreateTemp("", "")
	if err != nil {
		return err
	}

	defer os.Remove(tmpfile.Name())

	if _, err = tmpfile.Write(bytes); err != nil {
		return err
	}

	if err = tmpfile.Close(); err != nil {
		return err
	}

	if err = ExecSCP(tmpfile.Name(), dest); err != nil {
		return err
	}

	return nil
}

type ExecSCPFunc

type ExecSCPFunc func(args ...string) error
var ExecSCP ExecSCPFunc = func(args ...string) error {

	osCmd := exec.Command("scp", args...)
	osCmd.Stdin = os.Stdin
	osCmd.Stdout = os.Stdout
	osCmd.Stderr = os.Stderr

	return osCmd.Run()
}

Jump to

Keyboard shortcuts

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