diff --git a/diskspace_windows.go b/diskspace_windows.go index ef776042..49530022 100644 --- a/diskspace_windows.go +++ b/diskspace_windows.go @@ -20,34 +20,3 @@ func freeDiskSpaceBytes(dir string) (uint64, error) { log.Printf("Disk available: %v bytes", b) return b, nil } - -// ************************************************************************* -// We can probably delete this, it is an alternative version in case we have -// problems with simpler version above -// ************************************************************************* -func freeDiskSpaceBytes2(dir string) (uint64, error) { - kernel32, err := syscall.LoadLibrary("Kernel32.dll") - if err != nil { - log.Panic(err) - } - defer syscall.FreeLibrary(kernel32) - GetDiskFreeSpaceEx, err := syscall.GetProcAddress(syscall.Handle(kernel32), "GetDiskFreeSpaceExW") - if err != nil { - return 0, err - } - lpFreeBytesAvailable := int64(0) - lpTotalNumberOfBytes := int64(0) - lpTotalNumberOfFreeBytes := int64(0) - r, a, b := syscall.Syscall6( - uintptr(GetDiskFreeSpaceEx), - 4, - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr("C:"))), - uintptr(unsafe.Pointer(&lpFreeBytesAvailable)), - uintptr(unsafe.Pointer(&lpTotalNumberOfBytes)), - uintptr(unsafe.Pointer(&lpTotalNumberOfFreeBytes)), - 0, - 0, - ) - log.Print("Disk space:", r, a, b, lpFreeBytesAvailable, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes) - return uint64(lpFreeBytesAvailable), nil -} diff --git a/feature.go b/feature.go index f7df51a0..751e2dc8 100644 --- a/feature.go +++ b/feature.go @@ -17,9 +17,4 @@ type ( Start() *CommandExecutionError Stop(err *ExecutionErrors) } - - EnabledFeatures struct { - // A certificate should be generated which will include information for downstream tasks to build a level of trust for the artifacts produced by the task and the environment it ran in. - ChainOfTrust bool `json:"chainOfTrust,omitempty"` - } ) diff --git a/plat_windows.go b/plat_windows.go index 29ee12fb..f5e9d851 100644 --- a/plat_windows.go +++ b/plat_windows.go @@ -114,17 +114,6 @@ func immediateShutdown(cause string) { } } -func exceptionOrFailure(errCommand error) *CommandExecutionError { - switch errCommand.(type) { - case *exec.ExitError: - return &CommandExecutionError{ - Cause: errCommand, - TaskStatus: failed, - } - } - panic(errCommand) -} - func processCommandOutput(callback func(line string), prog string, options ...string) error { out, err := exec.Command(prog, options...).Output() if err != nil { diff --git a/powershell_windows.go b/powershell_windows.go deleted file mode 100644 index 9491053a..00000000 --- a/powershell_windows.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -import ( - "io/ioutil" -) - -// Creates a powershell script file with the given filename, that can be used -// to execute a command as a different user. The powershell script takes 4 -// positional arguments: the windows username, password, the script to run, and -// the working directory to run from. Returns an error if there is a problem -// creating the script. -func createRunAsUserScript(filename string) error { - scriptContents := "$username = $args[0]\r\n" - scriptContents += "$password = $args[1]\r\n" - scriptContents += "$script = $args[2]\r\n" - scriptContents += "$dir = $args[3]\r\n" - scriptContents += "\r\n" - scriptContents += "$credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))\r\n" - scriptContents += "\r\n" - scriptContents += "Start-Process $script -WorkingDirectory $dir -Credential ($credentials) -Wait\r\n" - return ioutil.WriteFile(filename, []byte(scriptContents), 0755) -} diff --git a/runasadministrator_windows.go b/runasadministrator_windows.go index b046798e..423dec88 100644 --- a/runasadministrator_windows.go +++ b/runasadministrator_windows.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "net/http" "github.com/taskcluster/generic-worker/win32" "github.com/taskcluster/taskcluster-base-go/scopes" @@ -47,9 +46,6 @@ func (l *RunAsAdministratorTask) RequiredScopes() scopes.Required { }} } -type RunAsAdministratorHandler struct { -} - func (l *RunAsAdministratorTask) Start() *CommandExecutionError { if config.RunTasksAsCurrentUser { // already running as LocalSystem with UAC elevation @@ -73,12 +69,5 @@ func (l *RunAsAdministratorTask) Start() *CommandExecutionError { return nil } -func ProcessRequests(s *http.Server) { - // s.ListenAndServe() -} - func (l *RunAsAdministratorTask) Stop(err *ExecutionErrors) { } - -func (handler *RunAsAdministratorHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) { -}