Reputation: 461
How can I run multiple commands in the same process in Ruby? For example, I should be able to run the command set TEMP=T
on Windows and when ran the command echo %TEMP%
later get a result of T
. The solution should be system independent.
Upvotes: 1
Views: 1499
Reputation: 385
Open a shell subprocess with popen, and save the handle. Run all your commands in this shell. You can have it as a singleton, if it should be accessible from anywhere within the program.
Upvotes: 1