node ninja
node ninja

Reputation: 32996

Does execv replace the current process like this?

If in my code, I were to call execv, and then I had several lines of code after the call to execv, would those lines get executed, or would they not get executed, since whatever was started by execv replaces the current process?

Upvotes: 0

Views: 1658

Answers (2)

Christopher Armstrong
Christopher Armstrong

Reputation: 7953

They would not get executed, unless you forked the thread and called execv on just one of them.

Upvotes: 1

Wyzard
Wyzard

Reputation: 34563

They wouldn't be executed, unless the execv() call failed. execv() completely replaces the program running in the process that calls it.

Upvotes: 2

Related Questions