Re: [PATCH] Re: Closing stdin of asynchronous sub processes
Brought to you by:
jsh,
nano-master
|
From: John H. <js...@un...> - 2005-04-07 18:20:58
|
thanks, I committed your patch,
John
On Apr 7, 2005, at 11:02 AM, Eric Mangold wrote:
> So I had a look at the librep source and came up with a patch to
> src/unix_processes.c that exposes a "close-process" function. It
> just calls the close_process_files C function that was already
> present.
>
> My test program below works perfectly once I added a call to
> close-process.
>
> Hopefully this can be committed?
>
> -Eric Mangold
>
>
>> Hello,
>>
>> I need set the primary X selection from rep (under sawfish) and it
>> seems
>> like using the xclip(1) program is the easiest way.
>>
>> To test outside of sawfish, I run this with rep:
>>
>> (setq proc (make-process))
>> (start-process proc "xclip" "-i") ;;this reads the text to set
>> from stdin
>> (write proc "set selection to this")
>>
>> OK, that works fine if you just run it with no event-loop. But, if
>> you add
>> the event loop...
>>
>> (setq interrupt-mode 'exit) ;; make it so we can C-c out
>> (setq proc (make-process))
>> (start-process proc "xclip" "-i") ;;this reads the text to set
>> from stdin
>> (write proc "set selection to this")
>> (recursive-edit)
>>
>> Then the xclip program is indeed launched but it never terminates
>> because
>> it's stdin is still waiting for EOF. Apparently in the non-event-loop
>> version, the terminating of the rep binary forces the stdin/out/
>> err of
>> xclip to be closed, and so xclip goes and does its thing.
>>
>> So how does one close the stdin (if that is indeed my problem)?
>>
>> Thanks,
>> Eric Mangold
>>
>>
>>
>> <unix_processes.c.diff>
>
|