// WaitForJob will wait for a WMI job to complete
WaitForJob will wait for a WMI job to complete
// WaitForJob will wait for a WMI job to complete
func WaitForJob(jobPath string) error {
	for {
		jobData, err := NewJobState(jobPath)
		if err != nil {
			return err
		}
		if jobData.JobState == JobStatusRunning {
			time.Sleep(100 * time.Millisecond)
			continue
		}
		if jobData.JobState != JobStateCompleted {
			return fmt.Errorf("Job failed: %s (%d)", jobData.ErrorDescription, jobData.ErrorCode)
		}
		break
	}
	return nil
}
func WaitForJob ( jobPath string ) error { for { jobData , err := NewJobState ( jobPath ) if err != nil { return err } if jobData . JobState == JobStatusRunning { time . Sleep ( 100 * time . Millisecond ) continue } if jobData . JobState != JobStateCompleted { return fmt . Errorf ( " " , jobData . ErrorDescription , jobData . ErrorCode ) } break } return nil }
WaitForJob will wait for a WMI job to complete
WaitForJob will wait for a WMI job to complete