src/SubProcess.cpp
branchv_0
changeset 62 a467e8cbd16b
parent 46 b5ae61996281
child 95 f2f2b81079a5
equal deleted inserted replaced
61:640ba8948d69 62:a467e8cbd16b
    55 	}
    55 	}
    56 
    56 
    57 	void write(string_t s) {
    57 	void write(string_t s) {
    58 		subInputWriter << convertor.to_bytes(s).c_str();
    58 		subInputWriter << convertor.to_bytes(s).c_str();
    59 		subInputWriter.put(SEPARATOR);
    59 		subInputWriter.put(SEPARATOR);
    60 		subInputWriter.flush();
       
    61 		if (subInputWriter.bad()) throw SubProcess::Exception(L"Unable to write to sub-process.");
    60 		if (subInputWriter.bad()) throw SubProcess::Exception(L"Unable to write to sub-process.");
    62 	}
    61 	}
    63 
    62 
    64 	void write(int i) {
    63 	void write(int i) {
    65 		write(std::to_wstring(i));
    64 		write(std::to_wstring(i));
       
    65 	}
       
    66 
       
    67 	void flush() {
       
    68 		subInputWriter.flush();
    66 	}
    69 	}
    67 
    70 
    68 public:
    71 public:
    69 
    72 
    70 	/**
    73 	/**
   169 
   172 
   170 	void write(Message m) {
   173 	void write(Message m) {
   171 		write(m.code);
   174 		write(m.code);
   172 		write(m.parameters.size());
   175 		write(m.parameters.size());
   173 		for (auto p : m.parameters) write(p);
   176 		for (auto p : m.parameters) write(p);
       
   177 		flush();
   174 	}
   178 	}
   175 
   179 
   176 	int wait() {
   180 	int wait() {
   177 		closeOrThrow(subInputWriterBuffer.fd());
   181 		closeOrThrow(subInputWriterBuffer.fd());
   178 		closeOrThrow(subOutputReaderBuffer.fd());
   182 		closeOrThrow(subOutputReaderBuffer.fd());