Ruby, Difference between exec, system and %x() or Backticks

前端 未结 3 1164
南旧
南旧 2020-11-22 16:47

What is the difference between the following Ruby methods?

exec, system and %x() or Backticks

I know they are

3条回答
  •  死守一世寂寞
    2020-11-22 17:15

    They do different things. exec replaces the current process with the new process and never returns. system invokes another process and returns its exit value to the current process. Using backticks invokes another process and returns the output of that process to the current process.

提交回复
热议问题