gianmarcotoso
I've noticed that if you send a file created through the `write` method as the payload of a response, it's returned empty. This is because the gnuplot process is still running and has not yet closed the file descriptor (at least on my configuration, Ubuntu 14.04 running on VirtualBox). I've solved this by moving what's in the `__construct` and `__destruct` methods inside two new methods, and calling them at the end of the `write` function (as well as in the constructor and the destructor). Like this: ``` php public function write($terminal, $file) { $this->sendInit(); $this->sendCommand("set terminal $terminal size {$this->width}{$this->unit}, {$this->height}{$this->unit}"); $this->sendCommand('set output "'.$file.'"'); $this->plot(); // Cleanup and re-init $this->cleanup(); $this->initialize(); } ``` Of course, this means that all the commands need to be sent again after each `write`, so I'm checking in before making a pull request to make sure this is ok. On a sidenote, I've already added line width support for individual lines and I'll be pushing it alongside this :)