#include "lib/nanomsg.h"
#include "lib/util.h"
#include "lib/version.h"
-#include "lib/warnings.h"
+#include <dcp/warnings.h>
#ifdef DCPOMATIC_POSIX
#include <sys/ioctl.h>
"com.dcpomatic.write-drive",
[xml]() {
bool const success = Drive(xml).unmount();
- if (!nanomsg->send(success ? (DISK_WRITER_OK "\n") : (DISK_WRITER_ERROR "\n"), LONG_TIMEOUT)) {
+ bool sent_reply = false;
+ if (success) {
+ sent_reply = nanomsg->send(DISK_WRITER_OK "\n", LONG_TIMEOUT);
+ } else {
+ sent_reply = nanomsg->send(DISK_WRITER_ERROR "\nCould not unmount drive\n1\n", LONG_TIMEOUT);
+ }
+ if (!sent_reply) {
LOG_DISK_NC("CommunicationFailedError in unmount_finished");
throw CommunicationFailedError ();
}
},
[]() {
- if (!nanomsg->send(DISK_WRITER_ERROR "\n", LONG_TIMEOUT)) {
+ if (!nanomsg->send(DISK_WRITER_ERROR "\nCould not get permission to unmount drive\n1\n", LONG_TIMEOUT)) {
LOG_DISK_NC("CommunicationFailedError in unmount_finished");
throw CommunicationFailedError ();
}
},
[]() {
if (nanomsg) {
- nanomsg->send(DISK_WRITER_ERROR "\nCould not obtain authorization to write to the drive\n", LONG_TIMEOUT);
+ nanomsg->send(DISK_WRITER_ERROR "\nCould not obtain authorization to write to the drive\n1\n", LONG_TIMEOUT);
}
});
}