process_stdin_write : 'process -> buf:string -> pos:int -> len:int -> int Write up to [len] bytes from [buf] starting at [pos] to the process stdin. Returns the number of bytes writen this way. Raise an exception if this process stdin is closed. **/
| 407 | </doc> |
| 408 | **/ |
| 409 | int _hx_std_process_stdin_write( Dynamic handle, Array<unsigned char> buf, int pos, int len ) |
| 410 | { |
| 411 | if( pos < 0 || len < 0 || pos + len > buf->length ) |
| 412 | return 0; |
| 413 | vprocess *p = getProcess(handle); |
| 414 | |
| 415 | unsigned char *src = &buf[0]; |
| 416 | |
| 417 | |
| 418 | hx::EnterGCFreeZone(); |
| 419 | #ifdef NEKO_WINDOWS |
| 420 | DWORD nbytes =0; |
| 421 | if( !WriteFile(p->iwrite,src+pos,len,&nbytes,0) ) |
| 422 | nbytes = 0; |
| 423 | #else |
| 424 | int nbytes = write(p->iwrite,src+pos,len); |
| 425 | if( nbytes == -1 ) |
| 426 | nbytes = 0; |
| 427 | #endif |
| 428 | |
| 429 | hx::ExitGCFreeZone(); |
| 430 | return nbytes; |
| 431 | } |
| 432 | |
| 433 | /** |
| 434 | process_stdin_close : 'process -> void |
nothing calls this directly
no test coverage detected