external-process

How do I launch a completely independent process from a Java program?

爷,独闯天下 提交于 2019-11-26 07:55:42
I am working on a program written in Java which, for some actions , launches external programs using user-configured command lines. Currently it uses Runtime.exec() and does not retain the Process reference (the launched programs are either a text editor or archive utility, so no need for the system in/out/err streams). There is a minor problem with this though, in that when the Java program exits, it doesn't really quit until all the launched programs are exited. I would greatly prefer it if the launched programs were completely independent of the JVM which launched them. The target operating

How to call an external program in python and retrieve the output and return code?

一世执手 提交于 2019-11-26 06:35:17
问题 How can I call an external program with a python script and retrieve the output and return code? 回答1: Look at the subprocess module: a simple example follows... from subprocess import Popen, PIPE process = Popen(["ls", "-la", "."], stdout=PIPE) (output, err) = process.communicate() exit_code = process.wait() 回答2: Following Ambroz Bizjak's previous comment, here is a solution that worked for me: import shlex from subprocess import Popen, PIPE cmd = "..." process = Popen(shlex.split(cmd),

How do I launch a completely independent process from a Java program?

梦想与她 提交于 2019-11-26 01:58:50
问题 I am working on a program written in Java which, for some actions , launches external programs using user-configured command lines. Currently it uses Runtime.exec() and does not retain the Process reference (the launched programs are either a text editor or archive utility, so no need for the system in/out/err streams). There is a minor problem with this though, in that when the Java program exits, it doesn\'t really quit until all the launched programs are exited. I would greatly prefer it

How can I run an external program from C and parse its output?

有些话、适合烂在心里 提交于 2019-11-25 23:06:09
问题 I\'ve got a utility that outputs a list of files required by a game. How can I run that utility within a C program and grab its output so I can act on it within the same program? UPDATE: Good call on the lack of information. The utility spits out a series of strings, and this is supposed to be complete portable across Mac/Windows/Linux. Please note, I\'m looking for a programmatic way to execute the utility and retain its output (which goes to stdout). 回答1: For simple problems in Unix-ish