From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Aur=C3=A9lien_Aptel?= Newsgroups: gmane.emacs.help Subject: Re: How to communicate with a running external process with given PID? Date: Mon, 22 Jul 2013 16:42:33 +0200 Message-ID: References: <87fvv9ha6o.fsf@gmail.com> <87txjmy97l.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1374504182 3315 80.91.229.3 (22 Jul 2013 14:43:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Jul 2013 14:43:02 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Thorsten Jolitz Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 22 16:43:04 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V1HKC-0001EC-DJ for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Jul 2013 16:42:56 +0200 Original-Received: from localhost ([::1]:38031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1HKC-0005Si-33 for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Jul 2013 10:42:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1HJy-0005Rw-PB for help-gnu-emacs@gnu.org; Mon, 22 Jul 2013 10:42:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1HJt-0007At-W6 for help-gnu-emacs@gnu.org; Mon, 22 Jul 2013 10:42:42 -0400 Original-Received: from mail-lb0-x22d.google.com ([2a00:1450:4010:c04::22d]:54641) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1HJq-0007AP-TY for help-gnu-emacs@gnu.org; Mon, 22 Jul 2013 10:42:37 -0400 Original-Received: by mail-lb0-f173.google.com with SMTP id v1so5333897lbd.32 for ; Mon, 22 Jul 2013 07:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=6o5TNk4dRDolEKbO74eTuuT0BS/E9fFUMcXHEQYxcXM=; b=h/thaWpuukO76bxdqDd0ApF15Vlo6XSa1Ass89fk/Etw+dYv7eYoiHojb5u3oIvACp PqHH1nMkZ9SdiBZDBjNhsNUkMCuPE/VkkSAYoMd9MX1t83uqsQeIeQ4tK+NJ7iXgy4ti sTy378AqLHX9iFCE8Io3WEi/WQwXVaSnnQOBFI0GSkfT1nkSPV1cwyNAgtjwHMluu2V/ cIR0+XYT32r/gV+xGqcTFwKwud8dTcFCN3bi3HD64ZIppFdzTEG/mZenunsIFzQwhS/u IcM7G2NUmvqHRRVXpL4qt2c7KRVR+qhi0CdFw/PkrCF7GkqCl6uAdWcVGFlDmXVmnOqL R4EA== X-Received: by 10.152.45.65 with SMTP id k1mr12675413lam.78.1374504153785; Mon, 22 Jul 2013 07:42:33 -0700 (PDT) Original-Received: by 10.114.66.235 with HTTP; Mon, 22 Jul 2013 07:42:33 -0700 (PDT) In-Reply-To: <87txjmy97l.fsf@gmail.com> X-Google-Sender-Auth: 0vDOpiDv_QQo2icr04BSvXN4Nxo X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::22d X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92320 Archived-At: On Mon, Jul 22, 2013 at 4:12 PM, Thorsten Jolitz wrote: >> Since Emacs did not start the external process, it does not have >> access to its standard input stream -- unless your OS provides a way >> to do that (e.g. via a special /dev file). >> >> How would you communicate with the external process, from any other >> program? > > I don't know, and I interpreted the responses so far to my post as "it > is impossible, only 'kill' can access the running external process with > given PID" - but kill sends signals, no command-strings or so. Kevin is right in that on Linux you can use /proc/$PID/fd/0 and 1 to access the file descriptor of the stdin and stdout of the program $PID. Actually, it's the input/output of the controlling terminal which means you have to use some tricks [1] to communicate with the process. 1: http://stackoverflow.com/questions/5374255/how-to-write-data-to-existing-processs-stdin-from-external-process?lq=1