bool job_write(int id, char *data, uint32_t len) { Job *job = find_job(id); if (job == NULL || job->stopped) { free(data); return false; } if (!wstream_write(job->in, data, len, true)) { job_stop(job->id); return false; } return true; }
/// Writes data to the job's stdin. This is a non-blocking operation, it /// returns when the write request was sent. /// /// @param job The Job instance /// @param buffer The buffer which contains the data to be written /// @return true if the write request was successfully sent, false if writing /// to the job stream failed (possibly because the OS buffer is full) bool job_write(Job *job, WBuffer *buffer) { return wstream_write(job->in, buffer); }