python - How to spawnProcess with multiple arguments in Twisted? -


I'm trying to start a process through twisted. I am parsing a JSON file with several commands in the following framework:

  {"key": "test", "cmd": "cat", "args": "/ Opt / Vinci / rxDaemons.json | grep cmd "," restart ": 5," auto ": 0}   

The command I'm trying to make is very simple; I am searching for a file for the word "CMD" (as I'm sure you can choose)

I am using this process to lay eggs, as follows:

  CMD, RGS, UID, GID, NV = selfprocesses [name] protoz = logging protocol () proto esrosis = self-protozes. Name = name itself Protocol [name] = Proto itself Time Starred [name] = self.rector .seconds () newArgs = str (cmd) .split () + args.split () self._reactor.spawnProcess (proto, str (cmd), args = newArgs, env = env, Uid = uid, gid = gid)   

The response is:

  cat: |: There is no such file or directory cat: grep: any such file Or directory is not a cat: cmd: such a file or directory   

this whole file cats then

I assume that we have a cat running on every ARG but I do not know why

I How do I properly use more than one argument with spawnProcess?

The problem is that | In POvern you can add shell = True to the command, but it is not available in twisted. The "right" solution is probably to implement piping in twisted, not in Bash.

Edit: In fact, in your case, this is the one, just run this command instead:

  grep cmd / opt / vinci / rxDaemons  < / Pre>  

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -